iPhone landscape issues

2019-03-04 03:25发布

问题:

xcode:4.5.2

I want to create an application in iPad;

I settings my info.plist as below:

Initial interface orientation: Landscape (left home button)

When I started my app, the orientation device have landscape mode, but my view not rotate to this orienatation.

I don't know what it is, who can help me

回答1:

are you implements these following methods.

 -(BOOL)shouldAutomaticallyForwardAppearanceMethods{   
         // This method is called to determine whether to 
         // automatically forward appearance-related containment
         //  callbacks to child view controllers.
        return YES;

    }
    -(BOOL)shouldAutomaticallyForwardRotationMethods{
        // This method is called to determine whether to
        // automatically forward rotation-related containment 
        // callbacks to child view controllers.
       return YES;
    }


回答2:

In ios6 you have to use this method for vieworientation

-(BOOL)shouldAutorotate
{
    return YES;
}
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskAll;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationMaskAll;
}