1. 程式人生 > >視訊播放時強制橫屏

視訊播放時強制橫屏

//螢幕旋轉
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
//進行自動旋轉
-(BOOL)shouldAutorotate
{
    return YES;
}
//設定在不同情況下支援的旋轉方向
-(NSUInteger)supportedInterfaceOrientations
{
    if (isFull) {
        return UIInterfaceOrientationMaskLandscapeRight;
    }else {
        
        return UIInterfaceOrientationMaskPortrait;
    }
    
    
}


//全屏時呼叫的方法
-(void)moviePlayerFullAction{
    isFull = YES;
    [self supportedInterfaceOrientations];
}


//返回時再改為豎屏
-(void)moviePlayerBack{
    isFull = NO;
}