iOS两个强制旋转屏幕的方法
来源:互联网 发布:php多用户商城 源码 编辑:程序博客网 时间:2024/06/09 18:10
第一个:
- // 状态栏动画持续时间
- 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];
- }
0 0
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- 两个强制屏幕旋转的方法
- iOS强制旋转屏幕
- ios屏幕强制旋转
- iOS强制屏幕旋转
- iOS屏幕强制旋转
- iOS 强制屏幕旋转
- iOS 强制旋转屏幕
- iOS - 强制旋转屏幕之代码实现
- iOS屏幕旋转,强制横竖屏
- iOS 禁止屏幕旋转的方法
- iOS 禁止屏幕旋转的方法
- 如何强制旋转屏幕
- IOS 关于IOS8屏幕的强制旋转与新的特性
- effective java 学习笔记——全书纲要
- git 介绍
- java 泛型学习笔记
- [sig14]《正当防卫3》的Clustered Shading光照技术
- 杨氏矩阵的编写
- iOS两个强制旋转屏幕的方法
- 使用mysql profiles 来查看sql 语句执行计划
- 无主之地1
- 【DB】【Spring】多数据源事物配置
- Objective-C Runtime中的并发内存分配
- 如何查看eclipse版本
- MFC 色变:形成有动感的图画
- 欢迎使用CSDN-markdown编辑器
- 定义类型类