iPad rotation bug when using MPMoviePlayerViewController

前端 未结 2 1160
迷失自我
迷失自我 2021-02-03 11:15

Issue summary

Changing the orientation of an iPad device or simulator while playing a video using MPMoviePlayerViewController results in an inconsistent rotation state

2条回答
  •  不要未来只要你来
    2021-02-03 11:47

    Successful response from Apple Developer Technical Support!

    This is a known bug and a we're received a number of duplicate bug reports and so iOS engineering is aware of the issue and we do have a temporary workaround as suggested by iOS engineering.

    You will need to implement this in the view controller which presents the movie player.

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
       [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
       [self performSelector:@selector(fixStatusBar) withObject:nil afterDelay:0];
    }
    
    - (void)fixStatusBar {
       [[UIApplication sharedApplication] setStatusBarOrientation:[self interfaceOrientation] animated:NO];
    }
    

    While this is somewhat ugly, it should fix the issue for now. It would be recommended to remove this code once the bug is fixed in the system.

    This took care of the issue completely for me, and you can revisit http://github.com/adamalex/FullScreenMovie for the code with the fix applied.

提交回复
热议问题