1.在AppDelegate.h 里添加標記2.在AppDelegate.m 里添加這個方法3.使用[(AppDelegate*)[UIApplication sharedApplication].delegate setAllowRotation:YES];來打開屏幕旋轉4.通過使用 [(AppD...
1.在AppDelegate.h 里添加標記
2.在AppDelegate.m 里添加這個方法
3.使用
[(AppDelegate*)[UIApplication sharedApplication].delegate setAllowRotation:YES];
來打開屏幕旋轉
4.通過使用
[(AppDelegate*)[UIApplication sharedApplication].delegate setAllowRotation:NO];
[[NSNotificationCenter defaultCenter] removeObserver:self];
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];
}
來取消屏幕旋轉