I have a UIScrollView which contains a sub-UIView, insetView which is used to display other UIViews, swapped in and out at runtime. These subviews aren’t only images, or single-view objects. They are fully functional views containing buttons, label, images, etc.
The problem that I am seeing is that as I zoom in and out, I’m noticing around the edges of my buttons these flickering lines keep appearing. The odd thing about these lines is that they can appear on any side of my buttons, but they never extend all the way to the corner of the button.
I can consistently, slowly zoom in and out and when one of the lines appear, I can slightly pinch and expand my fingers and I’ll see the same line disappear and show up again, and again with pretty fair consistency.
Is this a bug with the scaling algorithm? Is there some way that I can stop this?
This is one of those small details that doesn’t affect the function of the application but it is affects the level of polish considerably. On a screen with enough buttons, this is actually quite an annoyance.
Please see the two images below for an example. These are taken from a screenshot on my iPad, and I scaled them up a bit so that you can see the highlight. The pixelation comes from cutting off the anti-aliasing in my photo editor, not from the iPad.
This is an example with two buttons, next to one another. The first image looks correct, the second is the mistake.
Good Image

Bad Image

I found the answer. Buttons default to Rounded Rectangles. This means that it draws a rectangle in the background of the button.
I’m new to iOS development, so when I was setting the Image in IB for each button, I didn’t realize that the UIButton class would still draw the rectangle, even though it was to be over-drawn by my image. Apparently, at certain scaling intervals, edges of the rectangles can show up on your button. I don’t think this should happen and, yes, is a bug. However, the solution is tochange the Type of button in IB from
Rounded RecttoCustom.