iOS两个强制旋转屏幕的方法
来源:互联网 发布:php开发实战权威指南 编辑:程序博客网 时间:2024/06/09 17:54
第一个:
- // 状态栏动画持续时间
- CGFloat duration = [UIApplication sharedApplication].statusBarOrientationAnimationDuration;
- [UIView animateWithDuration:duration animations:^{
- // 修改状态栏的方向及view的方向进而强制旋转屏幕
- [[UIApplication sharedApplication] setStatusBarOrientation:_bottomView.landscapeModel ? UIInterfaceOrientationLandscapeRight : UIInterfaceOrientationPortrait];
- self.navigationController.view.transform = _bottomView.landscapeModel ? CGAffineTransformMakeRotation(M_PI_2) : CGAffineTransformIdentity;
- self.navigationController.view.bounds = CGRectMake(self.navigationController.view.bounds.origin.x, self.navigationController.view.bounds.origin.y, self.view.frame.size.height, self.view.frame.size.width);
- }];
第二个:
非arc:
- if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
- [[UIDevice currentDevice] performSelector:@selector(setOrientation:)
- withObject:(id)UIInterfaceOrientationLandscapeRight];
- }
arc下:
- if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
- SEL selector = NSSelectorFromString(@"setOrientation:");
- NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
- [invocation setSelector:selector];
- [invocation setTarget:[UIDevice currentDevice]];
- int val = UIInterfaceOrientationLandscapeRight;
- [invocation setArgument:&val atIndex:2];
- [invocation invoke];
- }
http://blog.csdn.net/yiyaaixuexi/article/details/8035014
0 0
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- 两个强制屏幕旋转的方法
- iOS强制旋转屏幕
- ios屏幕强制旋转
- iOS强制屏幕旋转
- iOS屏幕强制旋转
- iOS 强制屏幕旋转
- iOS 强制旋转屏幕
- iOS - 强制旋转屏幕之代码实现
- iOS屏幕旋转,强制横竖屏
- iOS 禁止屏幕旋转的方法
- iOS 禁止屏幕旋转的方法
- 如何强制旋转屏幕
- IOS 关于IOS8屏幕的强制旋转与新的特性
- 高德地图定位按钮位置显示
- jeecms项目相关配置文件
- HDOJ 题目1520 Anniversary party(树形dp)
- android CTS GTS 环境搭建
- Doing Homework again(区间选点)
- iOS两个强制旋转屏幕的方法
- eclipse环境 Cannot run program "C:\Java\jdk1.6.0_02\bin\javaw.exe" (in directory "D:\project\SDK"): Cr
- after Normal block(#47) at 0x001D3908 错误的一次解决经历
- Java中属性和字段的区别
- 深入C++之const对象行为
- JVM加载class文件的原理
- Populating Next Right Pointers in Each Node II
- selendroid
- HDU 月之数