views:

29

answers:

2

Hey,

I have a UINavigationController which appears at an offset of 20px. This is the exact problem I'm having: http://forums.macrumors.com/showthread.php?t=761616 But I can't seem to figure out what the right way to solve it is.

Thanks,

A: 

Make sure the frame is set at (0,0). It probably has that space because you add 20px to the Y position to make up for the status bar, but that is already handled for us.

Conceited Code
I didn't touch the frame. It's supposed to be aligned to 0,0 automatically.Plus, if I do try to manually adjust the frame, then I can see the offset and only a second of two after that, it pops into place.
Chonch
Did you try changing the frame in the "viewWillAppear:" method? And are you sure you haven't touched the frame in any of your code or xibs?
Conceited Code
Yes, I aven't touched the frame anywhere (not in the nib and not in the code). Plus, I just opened a new project, did the same thing and the offset was still there. And, when I hide the status bar the navigation bar appear on the top of the screen (40 px higher than it is now). I think I'm missing something here...
Chonch
A: 

Have you added a status bar as your top bar from Interface Builder?. May be you have kept space for status bar.

deamonsarea
No. I haven't touched the interface builder. I've added the navigation controller programmatically.
Chonch
I think its best to hide the status bar from the info.plist.There's a entry called "Status bar is initially hidden" in the plist. Tick that entry and remove your status bar hiding code from your project.
deamonsarea