views:

520

answers:

2

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?

A: 

Did you check to make sure that numberOfPages is not 0?

If you set a breakpoint can you see that pageControl is not nil?

jessecurry
Pages are set in code and are always greater than 0, it isn't nil because I can reference it in code just fine and manipulate values in it. I just can't *see* it.
Jasconius
A: 

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.

Jasconius
Can you explain exactly what you changed? I'm having this same problem - appears in IB, but never in the simulator. I've tried every combination of scaling, sizing, anchors that I can.Any help would be appreciated :-)
Danny Tuppeny
Looks like my problem was putting the control on a white background! Seems the selected dot is white, and the other dots are white with a lower alpha, so on a white background, none of them are visible!
Danny Tuppeny