当前位置:编程学习 > wap >>

如何修正iOS6上Oritentation的问题

1.将addSubview修改为setRootViewController


[window addSubview: viewController.view];修改如下:


if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
{
    // warning: addSubView doesn't work on iOS6
    [window addSubview: viewController.view];
}
else
{
    // use this mehod on ios6
    [window setRootViewController:viewController];
}
2.修改shouldAutorotateToInte易做图ceOrientation

 

- (BOOL)shouldAutorotateToInte易做图ceOrientation:(UIInte易做图ceOrientation)inte易做图ceOrientation
{
    return UIInte易做图ceOrientationIsLandscape( inte易做图ceOrientation );
}


iOS6以前会呼叫这方法来判断手机是垂直或打横


// For ios6, use supportedInte易做图ceOrientations & shouldAutorotate instead of shouldAutorotateToInte易做图ceOrientation
- (NSUInteger) supportedInte易做图ceOrientations{
    return UIInte易做图ceOrientationMaskLandscape;
}

- (BOOL) shouldAutorotate {
    return YES;
}
iOS6需在加上上面方法

 

补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,