How to get default LandscapeLeft Orientation in iOS5?

情到浓时终转凉″ 提交于 2019-12-02 03:47:23
Master Stroke

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

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

- (BOOL)shouldAutorotate {

UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation];

if (orientation==UIInterfaceOrientationPortrait) {
 // do some 

}

return YES;
}

Include both the methods to support both 5 and 6

Madhu

You need to provide

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

for that single View controller.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!