最近在做视屏播放,我用的系统原生的播放器,但是横竖屏切换的时候遇到问题,这里是我的解决办法,记在此处,日后查找也方便。
首先在AppDelegate中如下写:
//appdelegate.h加
@property (nonatomic, assign) BOOL allowRotation;
//appdelegate.m加
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (self.allowRotation) {
return UIInterfaceOrientationMaskPortrait |UIInterfaceOrientationMaskLandscapeLeft |UIInterfaceOrientationMaskLandscapeRight;
}