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.
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.