Reverting to portrait after Done pressed on movie player?

前端 未结 4 944
孤街浪徒
孤街浪徒 2020-12-20 09:09

I\'ve got a MPMoviePlayer working. It is designed to show a postage-stamp size movie as a subview in the view. When the phone is rotated into landscape, it goes into full sc

4条回答
  •  感动是毒
    2020-12-20 09:34

    @cannyboy...you just need to use below method in your APPDelegate.m if your application only works with portrait mode

    - (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    if ([[window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]])
    {
        //NSLog(@"in if part");
        return UIInterfaceOrientationMaskAllButUpsideDown;
    }
    else
    {
        //NSLog(@"in else part");
        return UIInterfaceOrientationMaskPortrait;
    }}
    

提交回复
热议问题