iOS6不支持shouldAutorotateToInterfaceOrientation

发现 b2c交易在ios6上webview随屏幕旋转了,可是b2c支持横屏的,缘由是ios6的委托 ios

iOS6下的 web

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
       return UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}

这个不会再被调用,取而代之的是这俩个组合:
- (BOOL)shouldAutorotate
{
   return YES;
}
 
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

固然,为了保持对旧版本系统行为的兼容性,不要删掉不用的那个调用。另外还有一个这个preferred朝向也能够加上
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeRight;

} app


b2c交易只支持横屏,网银交易须要支持横竖屏,因此若是在info.plist设置支持的方向,则再同以客户端下两种应用有冲突。解决这个问题的方法就是再前面的基础上再应用的delegate中加入以下回调:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (clientstate == 0)  /* 网银*/
        return UIInterfaceOrientationMaskAll;
    else/* b2c*/
        return UIInterfaceOrientationMaskLandscape;
} ide

简单说明: spa

UIInterfaceOrientationMaskLandscape  支持左右横屏
UIInterfaceOrientationMaskAll  支持四个方向旋转
UIInterfaceOrientationMaskAllButUpsideDown 支持除了UpsideDown之外的旋转 webview

相关文章
相关标签/搜索