直播电商平台开发,横竖屏切换的方法
//旋转方向
- (void)interfaceOrientation:(UIInterfaceOrientation)orientation
{
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 = orientation;
[invocation setArgument:&val atIndex:2];
[invocation invoke];
}
if (orientation == UIInterfaceOrientationLandscapeRight||orientation == UIInterfaceOrientationLandscapeLeft) {
// 设置横屏
} else if (orientation == UIInterfaceOrientationPortrait) {
// 设置竖屏
}else if (orientation == UIInterfaceOrientationPortraitUpsideDown){
//
}
}
以上就是 直播电商平台开发,横竖屏切换的方法,更多内容欢迎关注之后的文章
标签:orientation,横竖,selector,直播,UIDevice,invocation,电商 From: https://www.cnblogs.com/yunbaomengnan/p/17346404.html