ios 6中设备旋转问题
2014-02-24 14:23
309 查看
ios
[csharp] view
plaincopy
1.在APPDelegate里,将
[csharp] view
plaincopy
[csharp] view
plaincopy
[self.window addSubview:self.viewController.view];
改为
[csharp] view
plaincopy
判断当前设备系统
if ([[[UIDevice currentDevice]systemVersion]floatValue]>=4.0) {
//4.0以后支持
self.window.rootViewController = self.viewController;
}
else
[self.window addSubview:self.viewController.view];
2.在viewController.m中重写方法
[csharp] view
plaincopy
//ios6以后设备旋转
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
NSLog(@"ios6");
return UIInterfaceOrientationMaskAll;
// self.interfaceOrientation
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
NSLog(@"设备旋转");
}
3,在info。plist中增加相对应的方向即可
4.
获取自身屏幕方法,不要使用[[UIDevice curentDevice] orientation]
而是要使用self.interfaceOrientation或[[UIApplicationsharedApplication]statusBarOrientation]
ios6以前设备
[cpp] view
plaincopy
//ios 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
// return NO;
return (toInterfaceOrientation == UIInterfaceOrientationMaskLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationMaskLandscapeRight);
}
[csharp] view
plaincopy
1.在APPDelegate里,将
[csharp] view
plaincopy
[csharp] view
plaincopy
[self.window addSubview:self.viewController.view];
改为
[csharp] view
plaincopy
判断当前设备系统
if ([[[UIDevice currentDevice]systemVersion]floatValue]>=4.0) {
//4.0以后支持
self.window.rootViewController = self.viewController;
}
else
[self.window addSubview:self.viewController.view];
2.在viewController.m中重写方法
[csharp] view
plaincopy
//ios6以后设备旋转
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
NSLog(@"ios6");
return UIInterfaceOrientationMaskAll;
// self.interfaceOrientation
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
NSLog(@"设备旋转");
}
3,在info。plist中增加相对应的方向即可
4.
获取自身屏幕方法,不要使用[[UIDevice curentDevice] orientation]
而是要使用self.interfaceOrientation或[[UIApplicationsharedApplication]statusBarOrientation]
ios6以前设备
[cpp] view
plaincopy
//ios 5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
// return NO;
return (toInterfaceOrientation == UIInterfaceOrientationMaskLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationMaskLandscapeRight);
}
相关文章推荐
- 关于ios设备的旋转判断问题
- Three20研究院之解决真机IOS6在Xcode4.5下无法编译与IOS设备自动旋转问题(九)
- 移动端上传照片 预览(解决iOS等设备照片旋转90度的bug)
- iOS 检测设备旋转状态
- 利用exif.js解决ios手机上传竖拍照片旋转90度问题
- iOS下html上传图片被旋转问题
- WebSocket 学习笔记--IE,IOS,Android等设备的兼容性问题与代码实现
- 关于rotate动画在ios设备无效的问题
- iOS BLE 关于app连接已配对设备的问题
- IOS 旋转问题
- 利用exif.js解决ios或Android手机上传竖拍照片旋转90度问题
- iOS图片旋转问题
- IOS 6的自动旋转问题
- iOS 有关旋转屏幕的问题
- 解决ios上传的图片旋转问题
- 关于iOS app的设备方向支持的问题
- IOS设备屏幕旋转相关技术收集
- iOS 10 设备权限问题(相机,相册等)
- IOS 学习笔记12 设备旋转
- iOS旋转图片锯齿问题