I need to implement behavior of my UIViewController subclass like in standart iPod.app: when device rotated from portrait to landscape, content of UIViewController stay’s still and new view add’s above it.
The problem is that, when set
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
the content is rotating
but when set
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return NO;
}
function
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
NSLog(@"did rotate form interface orientation %d",fromInterfaceOrientation);
}
is newer called
So, do you know how to handle device rotation inside UIViewController without rotating it content?
Actually, you do NOT want your viewController to respond to interface orientation rotation.
Instead, it is easier just to observe UIAccelerometer notifications. Then do a full swap of the view.
You can see the code to do this here on SO:
Rotating the iPhone, and instantiating a new UIViewController?
and
UIDevice Orientation