Reputation: 28740
I'm Using this category for supporting Auto rotation in ios 6
@implementation UINavigationController (RotationIn_IOS6)
-(BOOL)shouldAutorotate
{
NSLog(@"Last Object is %@",[[self.viewControllers lastObject] description]);
return [[self.viewControllers lastObject] shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations
{
return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}
My application setup is like this
-(BOOL)shouldAutorotate
is implemented in home screen Anyone knows how to solve this ?
Upvotes: 0
Views: 106
Reputation: 10195
According to the answer to this question using a Category to override a method in a Cocoa class is a bad idea. 'the behavior is undefined as to which method implementation is used at runtime'.
I use a subclass of UINavigationController to achieve what you are trying to do and haven't had any problems so I suggest you try that instead.
Upvotes: 1