Search code examples
iphoneobjective-ccocoa-touchiphone-sdk-3.0

UIPageControl render quirk with UIScrollView


I'm building an iPhone application and like most I am trying to implement a UIScrollView with a UIPageControl, however I am coming across a very quirky behavior, which I assume may be a bug. Hopefully one of you has seen this before because it is driving me nuts.

Basically, the page control works fine, everything is hooked up and works normally on all accounts EXCEPT, with certain placements of the UIPageControl within the UIView, the UIPageControl will cease to render.

I'll just take screenshots of the XIB window to help illustrate... here's a placement that works perfectly fine:

http://www.jasconi.us/prob1.png

The UIPageControl is placed physically above the UIScrollView. Works great, everything is visible and working.

The next two DO NOT work:

http://www.jasconi.us/prob2.png http://www.jasconi.us/prob3.png

The first one is simply placed below the scroll view. Doesn't render at all.

The second one is placed above the scroll view without technically being inside of it. Also doesn't render.

What the hell is up with this? I've tried using

[[self view] bringSubviewToFront:pageControl];

...to no avail.

Any ideas?


Solution

  • OK I found the answer to this, it's a little six degrees of Kevin Bacon.

    This isn't actually a software bug, but a XIB quirk, for some reason the lower placement of the page control in combination with the default settings for autosize and anchor seem to jettison the control into outer space.

    If you turn off all auto-scaling and auto-sizing and auto-anchoring and all that other crap, the controls appear exactly as you expected. The fact that it appears reliably when placed above the ScrollView is an oddity.

    shrug.

    Hope this helps future iPhone initiates.