How to get default LandscapeLeft Orientation in iOS5?

前端 未结 4 1035

Sorry if this question is duplicate, but I can\'t find the same solution. In iOS6, if I want to set default orientation for one UIViewController, I just use:

- (         


        
相关标签:
4条回答
  • 2021-01-28 02:46

    call the below method where you want to check the status of orientation.happy coding :-)

    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
    {
        [self CheckForViewForOrientation:toInterfaceOrientation];
    }
    
    - (void) CheckForViewForOrientation:(UIInterfaceOrientation)orientation
    {
        if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
        {
            //Ur lable portrait view
        }
        else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
        {
            //Ur lable for landscape view
        }
    }
    
    0 讨论(0)
  • 2021-01-28 02:48
    - (BOOL)shouldAutorotate {
    
    UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];
    
    if (orientation==UIInterfaceOrientationPortrait) {
     // do some 
    
    }
    
    return YES;
    }
    

    Include both the methods to support both 5 and 6

    0 讨论(0)
  • 2021-01-28 02:49

    If you want to achieve this for whole application, change supported orientation UISupportedInterfaceOrientations in app.plist file

    0 讨论(0)
  • You need to provide

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
         UIInterfaceOrientationIsLandscape(interfaceOrientation);
    }
    

    for that single View controller.

    0 讨论(0)
提交回复
热议问题