强制横屏
来源:互联网 发布:云南地税网络申报平台 编辑:程序博客网 时间:2024/06/06 13:22
- (void)viewWillAppear:(BOOL)animated{
//强制横屏
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];
}
}
- (void)viewWillDisappear:(BOOL)animated{
//强制竖屏
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 = UIInterfaceOrientationPortrait;
[invocation setArgument:&val atIndex:2];
[invocation invoke];
}
}
//强制横屏
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];
}
}
- (void)viewWillDisappear:(BOOL)animated{
//强制竖屏
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 = UIInterfaceOrientationPortrait;
[invocation setArgument:&val atIndex:2];
[invocation invoke];
}
}
0 0
- Android 强制横屏
- ios强制横屏
- 强制横屏
- 强制横屏
- android 强制横屏
- iOS 强制横屏
- 强制横屏
- iOS强制横屏
- 强制横屏
- 强制转成横屏
- iOS强制横屏
- Android 强制横屏
- 强制横屏
- iOS9强制横屏
- 强制横屏
- ios强制横屏
- iOS强制横屏
- android全屏,强制竖屏,强制横屏
- UVA 11624 Fire! (BFS)
- LeetCode2.1.23~2.1.24(Single Number与Single Number II)
- Linux下进程之间通信机制
- 网易电面-静态库与动态库
- 我的第一篇博客,就要开始啦
- 强制横屏
- Azure中的WEB项目与Azure的MySQL连接
- 黑马程序员----JavaSE一些常用基础知识点记录-学习日记
- 模拟 hdu5414 CRB and String
- jQuery上传插件uploadify判断文件是否存在
- NIST SP800系列标准
- PL/SQL Developer主界面窗口默认设置
- Android SDK Manager下载
- Java实现二叉树的相关操作