kernelpanic
kernelpanic

Reputation: 530

When I load a new view in Cocoa Touch, it shifts everything up about 20 pixels

enter image description here

Ok so as seen in this picture progression, I have a home screen with a button named "Songs" on it. When this is pressed, it loads a new Nib and .h and .m files as seen in the middle picture. Then the back button brings us back to the home menu.

The problem is when I load that new view it shifts everything up 20 pixels (around how much the status bars are). Does anyone have any idea why this is. Let me know. I can provide code too.

Upvotes: 3

Views: 269

Answers (3)

sudo rm -rf
sudo rm -rf

Reputation: 29524

I've had this problem before. The only way I could remedy it was to set each new view I created to the size of the screen. Here's how I did it:

CGRect fullFrame = [[UIScreen mainScreen] applicationFrame];
self.view.frame  = fullFrame;

Upvotes: 3

Alexsander Akers
Alexsander Akers

Reputation: 16024

The problem is probably that wantsFullScreenLayout is set to YES somewhere. Check your UIViewControllers.

Upvotes: 2

Max
Max

Reputation: 16719

You're probably adding the view to the window with the frame (0,0, 320,460). So add 20 pixels to the y coordinate. The better choice would be using the UIViewController instead.

Upvotes: 1

Related Questions