Ram
Ram

Reputation: 1697

Autorotation not working ios6.1

Autorotation is not working in ios6.1. But following code is working in other app.

code:

@implementation UINavigationController (RotationIn_IOS6)

-(BOOL)shouldAutorotate
{
    return [[self.viewControllers lastObject] shouldAutorotate];
}

-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject]  preferredInterfaceOrientationForPresentation];
}

@end


- (BOOL)shouldAutorotate
{
    //returns true if want to allow orientation change
    return TRUE;


}
- (NSUInteger)supportedInterfaceOrientations
{
    //decide number of origination tob supported by Viewcontroller.
    return UIInterfaceOrientationMaskAll;


}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    //from here you Should try to Preferred orientation for ViewController

    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight | UIInterfaceOrientationPortrait;
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)  interfaceOrientation duration:(NSTimeInterval)duration
{

}

Upvotes: 0

Views: 141

Answers (3)

dhaya
dhaya

Reputation: 1522

Please check your project targets summery is like below

enter image description here

Upvotes: 0

user2256714
user2256714

Reputation: 11

ios6 uses mainly the plist options for autorotation. Try to setup the supported orientations fields.

Upvotes: 1

BalestraPatrick
BalestraPatrick

Reputation: 10144

Have you tried to modify the plist?

Upvotes: 0

Related Questions