setContentOffset:animated: shows view background - iphone

I have a UIScrollView with with different view controllers for each page inside it. When I use setContentOffset:animated: to scroll to a different page I can see a white line between the pages. This white line doesn't appear when I scroll by dragging the UIScrollView.
Has anyone seen this problem before? Any idea of what I might be doing wrong?
Thanks!

Setting all of your backgrounds (as in all layers deep) to magenta is a good test, but you may find that doesn't help. I have the same bug, but everything I have is black. The white line is there scrolling some directions.

Related

UIScrollView has its own dot indictators?

I have a ViewController with a view that contains a ScrollView and a PageControl positioned at the bottom.
What I noticed however, is that the ScrollView already has its own set of 3 dot indicators. So, just for the sake of testing, if I move around my PageControl bar, I can actually see two sets of dot indicators.
I have my IBOutlet set to my PageControl, so the dots get updated as I'd expect. However, the dots on the ScrollView don't change (and there are always 3 of them).
Why does the ScrollView already have its own dots? I tried unchecking "Show horizontal scrollers" but this did not get rid of the dots.
I guess why question is two-fold: How could I remove the dots from the ScrollView since I really only want the PageControl? Secondly, what is the purpose of having those dots on the ScrollView itself?
To be clear, I've already unchecked the Show horizontal and vertical scrollers in Interface Builder. I have also disabled them programatically:
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
Thank you in advance!
The UIScrollView does not have dots. Maybe you added two UIPageControls accidentally. If you show more code maybe we can help but all I can tell you is that a UIScrollView is not the source of the dots.

How can I specify where I want my UI elements to go on orientation change in Interface Builder?

Ok so I know this is a bit of a newbie question, but being that I am a newbie its ok! I have a view that I am trying to make orientation friendly in IB, and I am having some difficulties.
I have everything looking nice in portrait of course, but then when I go to landscape mode (by hitting that arrow in the top-right corner) everything gets all messed up.
Now, because of the way the view is laid out, I need to align 3 buttons along the bottom of an image view in portrait, and then in landscape, those three buttons need to be symmetrically aligned along the right side.
No combination of fiddling with those red arrows in the size inspector are rewarding me the results I am seeking. Is it possible to set up the buttons one way in one orientation in IB, and then on change, set them completely different?
I have looked all around for a useful IB tutorial, but haven't been able to find anything.
I know you want to do this in IB, but if you're willing to try it programmatically, then you can move things around pretty easily. For your buttons, just implement the setCenter method like this:
[myButton setCenter:CGPointMake(xCenter,yCenter)];
Otherwise, if you want to use the IB, use the Autosizing options. The arrows will stretch or compress the width and height, and the bars (|-|) preserve distances from the top and bottom. If you have three buttons in a row, you can fix the left distance for the left button, the right distance for the right button and both/neither for the center button. Something like that may work.
The third option is to make a new view, call it landscapeView or something, by dragging a UIView from the library to the window with File's Owner, First Responder, View, etc. Then orient that to landscape, copy over all your UI objects, lay them out as you like, and when you rotate, replace the current view with landscapeView. The problem with this that I've found (one of many) is that you have to reconnect everything and have different IBOutlets for the labels and whatnot. T
Using IB's autosizing features can only do so much. PengOne does a good job of describing them in his second paragraph. If they are not enough, you have to move the elements programmatically. See Responding to Orientation Changes. Otherwise, you can just use a completely different view, again as mentioned by PengOne.

UIView mysteriously expand by 1 pix when added to as subview

I created a custom "component" made up of UIView and it gets added as subview on any visible view. What I found strange is that when it get added to a view the second time, the width got increased by 1 pix. This caused a problem when it expanded the background image and causes the image to blur out.
Any ideas why a view will get expanded (or shrink) when added to another view?
The issue may be related to the location of the view.
Perhaps one of these stories will shed more light on the issue:
Fixing Blurry Subviews
Why does a PNG image sometimes get blurry depending on its position in a view

UITextView text is pixelated when loaded from my XIB file

Ok, I've got a XIB class called MenuItemView with 3 sub views, a UIImage, a UILabel, and a UITextView.
I'm dynamically loading instances of MenuItemView as pages in a UIScrollView. It creates a similar effect of scrolling through food items in the Chipotle app.
My problem is, the text in both the UILabel and UITextView are becoming very pixelated when loading the views.
Has anyone run into this before? Is there something I'm just overlooking here?
Are you using the shouldRasterize option on the layer of the label/textview? I was doing this awhile back and it seems to mess up the contents of UILabels and TextViews
Can you post a screenshot somewhere to better explain what you mean by "pixelated" here? If what you mean is "blurry" then the most common cause of that is drawing on fractional pixels, which can happen if you do things like center the text without rounding/truncating the result to a whole pixel.
If you really mean pixelated (where oversized pixels are visible), then I would suspect that you are scaling a font inappropriately. This could happen if you apply a scaling transform to the view, or in some cases if you mess with the bounds.

ScrollView with scrollViews - what is the right way to do it?

Client wants some tricky stuff and i don't really know where to start with it.
The idea is that there is a horizontal scrollView whose each page consists of a vertical scrollView.
For example, on the horizontal axis there are galleries, on the vertical we scroll through selected gallery's images. Is this even possible?
I'd be very glad to hear comments on this one!
You will have to manage the state yourself. When one scrollbar is selected the other has to be disabled and vice versa. You can also disable the user scrolling and handle the swiping yourself with the touch events. (on a clearColor UIView as a topmost view).
They all works magically, there's no additional work for this unless there's an issue about memory consumption which will require more coding.
Simply, create a horizontal scroll view then add vertical scroll views into it. Don't forget to update the contentSize property.