横竖屏切换

 

单一控制器的横竖屏切换

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];

}

posted @ 2016-06-20 11:55  小眼奇遇记  阅读(107)  评论(0编辑  收藏  举报