iOS 視頻播放橫屏,隱藏狀態欄


   MPMoviePlayerViewController *moviePlayerViewController = [[MPMoviePlayerViewController alloc] init];
    moviePlayerViewController.view.frame = CGRectMake(0, 0, self.view.bounds.size.height, self.view.bounds.size.width);
    moviePlayerViewController.view.center = CGPointMake(self.view.bounds.size.width/2, self.view.bounds.size.height/2);
    CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI/2);
    [moviePlayerViewController.view setTransform:transform];
    [self.view addSubview:moviePlayerViewController.view];

 

如果需要放大可以設置 moviePlayerViewController.scalingMode 屬性,有4種可選。

你會發現系統狀態欄會隨着屏幕旋轉,這時候最好的方法是將其隱藏

在viewWillAppear:里[[UIApplication sharedApplication] setStatusBarHidden:YES];

viewDidDisappear:里[[UIApplication sharedApplication] setStatusBarHidden:NO];


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM