两个强制屏幕旋转的方法
来源:互联网 发布:会计软件下载 编辑:程序博客网 时间:2024/06/09 19:08
第一个:
?
1
2
3
4
5
6
7
8
// 状态栏动画持续时间
CGFloat duration = [UIApplicationsharedApplication].statusBarOrientationAnimationDuration;
[UIView animateWithDuration:durationanimations:^{
//修改状态栏的方向及view的方向进而强制旋转屏幕
[[UIApplicationsharedApplication]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:
?
1
2
3
4
if
([[UIDevice currentDevice]respondsToSelector:@selector(setOrientation:)]){
[[UIDevicecurrentDevice]performSelector:@selector(setOrientation:)
withObject:(id)UIInterfaceOrientationLandscapeRight];
}
arc下:
?
1
2
3
4
5
6
7
8
9
if
([[UIDevice currentDevice]respondsToSelector:@selector(setOrientation:)]){
SELselector = NSSelectorFromString(@
"setOrientation:"
);
NSInvocation*invocation = [NSInvocation invocationWithMethodSignature:[UIDeviceinstanceMethodSignatureForSelector:selector]];
[invocationsetSelector:selector];
[invocationsetTarget:[UIDevice currentDevice]];
int
val =UIInterfaceOrientationLandscapeRight;
[invocationsetArgument:&val atIndex:2];
[invocationinvoke];
}
0 0
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- iOS两个强制旋转屏幕的方法
- 两个强制屏幕旋转的方法
- iOS强制旋转屏幕
- ios屏幕强制旋转
- 如何强制旋转屏幕
- iOS强制屏幕旋转
- iOS屏幕强制旋转
- iOS 强制屏幕旋转
- iOS 强制旋转屏幕
- 手动屏幕旋转的方法
- 屏幕旋转调用的方法
- 强制跳过WM调整屏幕的方法
- WinCE 实现屏幕旋转的方法
- wince实现屏幕旋转的方法
- Android 支付宝接入流程
- leetcode 21. Merge Two Sorted Lists
- appstore上架后的app怎么下架
- ios5中UIViewController addC…
- 2015年06月08日
- 两个强制屏幕旋转的方法
- iOS中延时执行的几种方式的比较和…
- iOS多线程GCD
- iphone开发用正则判断邮箱、密码是…
- iOS 获取手机码时间倒计时(定…
- mac针对svn地址变换的措施
- 军,团, 营, 连, 排…
- eclipse项目迁移到android st…
- struts2+ajax+json的使用