views:

1304

answers:

3
A: 

Check your autoresizing mask on all views in your nib and make sure its all set properly. If you have anything the way its not supposed to be it will freak out on rotation.

Squeegy
A little confused by this answer. What would be the proper resizing mask? I just left it default.
Corey Floyd
This: http://tinyurl.com/belg95 It affects what the view does when its superview resizes. Click the outer lines to affect how the position of the view will change, and the inner arrow to affect how the view itself will resize. Also click the arrow on the IB window to test the rotation.
Squeegy
To clarify my last point: click the little arrow in the upper right on the title bar of the window your views are layed out in. This will do an autrotation for you and you can see how you resize masks are working out.
Squeegy
A: 

Not sure why it's necessary, but when you're swaping views, you must apply a transformation to your view (with only 1 view the iPhone does this for you), and you must set the bounds of it.

Here is the code that should work for you (on the willAnimateFirstHalfOfRotationToInterfaceOrientation):

#define degreesToRadians(x) (M_PI * (x) / 180.0)
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
    self.view = landscapeView;
    self.view.transform = CGAffineTransformIdentity;
    self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(90));
    self.view.bounds = CGRectMake(0.0, 0.0, 480.0, 320);

} else {
    self.view = portraitView;
    self.view.transform = CGAffineTransformIdentity;
    self.view.transform = CGAffineTransformMakeRotation(degreesToRadians(0));
    self.view.bounds = CGRectMake(0.0, 0.0, 300, 480);
}
Alexandre L Telles
A: 

In the end, I reworked my app. (to use a modal view controller)

But I came into similar issues, instead white space where the status bar was located.

I think both problems can be attributed to not talking to the Navigation Controller when rotating/resizing views (instead I was talking to the ViewController.

For details of how I solved the problem:

http://stackoverflow.com/questions/563956/iphone-cgaffinetransformrotatepi-2-statusbarhiddenyes-presentmodalviewco/568174#568174

Corey Floyd