Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fenrus110

macrumors regular
Original poster
Mar 24, 2008
142
0
Setting shouldAutorotateToInterfaceOrientation to YES is easy enough and works fine for plain views.

But if I'm pushing UIViewControllers into a UINavigationController and try to rotate, it doesn't seem to quite go in the right spot and leaves a bunch of nasty black space.

It gets even more tricky when you try to set the navigation bar to hidden, it seems to do crazy things.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Usually NavBars rotate just fine. When you see some black space around your views it means that you haven't set up the autoresizing mask correctly.

Regarding hidden navbars and rotation I haven't played with this so I don't know what the story is. Possibly the navbar isn't being resized when it's hidden and it gets confused if it's hidden, rotated, and then unhidden. Maybe you can force it to resize even though it's hidden. This may be an apple bug.

The navbar is a different height in landscape vs portrait.
 

Niiro13

macrumors 68000
Feb 12, 2008
1,719
0
Illinois
Code:
– willRotateToInterfaceOrientation:duration:  
– didRotateFromInterfaceOrientation:

What works for me is to hide the navigation bar in the first method.

Then unhide it in the second method.

What I also do is make sure I set the frame sizes in the second method.
 

fenrus110

macrumors regular
Original poster
Mar 24, 2008
142
0
there is something totally bugged out about this. I'm in a screen with a UITableView in landscape mode. I touch a row to push the next screen in, which is also in landscape mode.

In my viewWillAppear, I setNavigationBarHidden:YES

In my viewDidLoad I put in:
self.view.frame = CGRectMake(0, 0, 480, 320);

I've tried varying combinations, but the result is always the same, I get a 32 pixel high black space at the bottom. (which is the height of a landscape navigation bar)

I tried adding a toolbar to the bottom, and I could not interact with the buttons because they were in this hidden 32 pixel high space.
toolbar.frame = CGRectMake(0, 288, 480, 44);

Now, if I setNavigationBarHidden:YES, in my didSelectRowAtIndexPath, the 32 pixel appears at the top. So if I want to put stuff to have the appearance of having something there, I put in a negative Y value. But if I need to interact with that area, I'm out of luck.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.