问题解决:iOS6下UIWebView嵌vedio标签播放视频屏幕不旋转

在iOS6环境下,当UIWebView中嵌入Vedio标签播放视频时,发现屏幕无法自动旋转,而此问题在iOS5中并不存在。针对这一问题,可以通过版本判断宏来实现特定版本的解决方案。
摘要由CSDN通过智能技术生成

项目默认为竖屏,在iOS6下UIWebView嵌Vedio标签播放视频屏幕不旋转,iOS5没有问题。


一、版本判断宏

// iOS版本===
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
// ===iOS版本


二、首先,在UIWebView所在controller下面开启屏幕旋转支持,iOS5点击UIWebView中vedio标签,播放器可以自动旋转;iOS6不行

#pragma mark - Rotation
// IOS5支持的屏幕方向
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

// IOS6开启旋转
- (BOOL)shouldAutorotate {
    return YES;
}
// IOS6支持的屏幕方向
- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAllButUpsideDown;
}
// IOS6默认支持竖屏
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationPortrait;
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值