Reputation: 4199
I have made a subclass of TTPhotoViewController, wich when I Rotate iPhone also the current image is rotated but NOT The navigation bar and the toolbar (the bar with prev and next button).
In my subclass I have overide the shouldAutorotateToInterfaceOrientation:
method:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
I've tried to overide willRotateToInterfaceOrientation:duration: e set up a breakpoint inside but seem that this method is never called.
Upvotes: 0
Views: 367
Reputation: 4199
I solved as follow:
TTPhotoViewController
was within a TabBarController
and by default TabBarController
doesn't return YES
for shouldAutorotateToInterfaceOrientation
. So just subclass TabBarController and do something like that:
@implementation CustomTabBarController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
@end
I add a small detail: in my firts attempt to rotate the interface i've found that the deviceOrientationDidChange:
in TTScrollView.m
was commeted out, this is done because if you decomment this code the scroll view have a strange behaviour on landascape rotation.
Upvotes: 1
Reputation: 5123
Make sure all your view controllers i.e. Parent view controllers are allowing rotations.. most likely it is happening because one or more view controller is not returning TRUE for shouldAutorotateToInterfaceOrientation
Upvotes: 1