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.
A:
Squeegy
2009-02-18 06:56:23
A little confused by this answer. What would be the proper resizing mask? I just left it default.
Corey Floyd
2009-02-18 07:02:20
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
2009-02-18 07:34:01
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
2009-02-18 07:35:38
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
2009-02-18 13:19:04
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:
Corey Floyd
2009-02-20 03:33:26