转:ios7(自动旋屏)iOS6不支…
2013-12-20 13:02
246 查看
原文地址:转:ios7(自动旋屏)iOS6不支持shouldAutorotateToInterfaceOrientation作者:Easonchen参考开源中国——双子座教程ios7
http://my.oschina.net/plumsoft/blog/47289
发现 b2c交易在ios6上webview随屏幕旋转了,但是b2c支持横屏的,原因是ios6的委托
iOS6下的
-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return
UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
这个不会再被调用,取而代之的是这俩个组合:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskLandscape;
}
当然,为了保持对旧版本系统行为的兼容性,不要删掉不用的那个调用。另外还有一个这个preferred朝向也可以加上
-
(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return
UIInterfaceOrientationLandscapeRight;
}
b2c交易只支持横屏,网银交易需要支持横竖屏,所以如果在info.plist设置支持的方向,则再同以客户端下两种应用有冲突。解决这个问题的方法就是再前面的基础上再应用的delegate中加入如下回调:
- (NSUInteger)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if
(clientstate == 0)
return UIInterfaceOrientationMaskAll;
else
return UIInterfaceOrientationMaskLandscape;
}
简单说明:
UIInterfaceOrientationMaskLandscape
支持左右横屏
UIInterfaceOrientationMaskAll 支持四个方向旋转
UIInterfaceOrientationMaskAllButUpsideDown 支持除了UpsideDown以外的旋转
http://my.oschina.net/plumsoft/blog/47289
发现 b2c交易在ios6上webview随屏幕旋转了,但是b2c支持横屏的,原因是ios6的委托
iOS6下的
-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
return
UIInterfaceOrientationIsLandscape(toInterfaceOrientation);
}
这个不会再被调用,取而代之的是这俩个组合:
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskLandscape;
}
当然,为了保持对旧版本系统行为的兼容性,不要删掉不用的那个调用。另外还有一个这个preferred朝向也可以加上
-
(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return
UIInterfaceOrientationLandscapeRight;
}
b2c交易只支持横屏,网银交易需要支持横竖屏,所以如果在info.plist设置支持的方向,则再同以客户端下两种应用有冲突。解决这个问题的方法就是再前面的基础上再应用的delegate中加入如下回调:
- (NSUInteger)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if
(clientstate == 0)
return UIInterfaceOrientationMaskAll;
else
return UIInterfaceOrientationMaskLandscape;
}
简单说明:
UIInterfaceOrientationMaskLandscape
支持左右横屏
UIInterfaceOrientationMaskAll 支持四个方向旋转
UIInterfaceOrientationMaskAllButUpsideDown 支持除了UpsideDown以外的旋转
相关文章推荐
- 转:ios7(自动旋屏)iOS6不支持shouldAutorotateToInterfaceOrientation
- 转:ios7(自动旋屏)iOS6不支…
- 转:ios7(自动旋屏)iOS6不支…
- ios7(自动旋屏)iOS6不支持shouldAutorotateToInterfaceOrientation
- 转:ios7(自动旋屏)iOS6不支持shou…
- iOS6,iOS7文字长度计算问题,可变长文字的自动适配显示
- 关于iOS6与iOS7下的自动获取字体si…
- iOS UIViewController 无法关闭自动旋屏(自动旋转、手动旋转、兼容IOS6之前系统)
- IOS Label 自动换行 IOS6和IOS7
- 开始iOS 7中自动布局教程(一) 从iOS6讲到iOS7以后
- UIViewController中的view自动排版(ios6和ios7)
- ios6, ios7上文字长度计算问题, 可变长文字的自动适配显示
- IOS6屏幕自动旋转设置测试
- iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- IOS6和IOS7 显示一样的SearchBar
- iOS(iOS7 iOS6)推送教程(一步一步实现,简单易懂)
- 在做私密相册的SDK,奇怪的是在ios6上项目里的navigationbar可以传进来一直往下传,但在ios7上却只可以传一层,原来答案在下边
- IOS iOS5,iOS6,iOS7中UITabBarController,UINavigationController等界面中的旋转问题总结
- ios6,ios7,ios7.1下设置UISearchbar的背景色
- IOS6、IOS7—内存警告处理