Fill master and detail view in full screen mode of iPad

前端 未结 1 908
一个人的身影
一个人的身影 2020-12-29 17:05

I am using Master-Detail Application template, in my iPad application.
I have master-view that contains list of videos. When selecting any list item, it starts playing v

相关标签:
1条回答
  • 2020-12-29 17:42

    you can Hide or show MasterViewcontroller By using Delegate of UISplitViewController

    - (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
    
    - (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem;
    
    - (void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc;
    

    UPDATE:-

    Example Code:-

    set One BOOL value in you DetailViewController.h class

    @interface DetailViewController : UIViewController <UISplitViewControllerDelegate>
    
    @property (nonatomic) BOOL  IShide;
    

    and Do this Following Method into you .M class

    -(void)hideMaster:(id)hideState
    {
    
        _IShide=!self.IShide;
        [self.splitViewController.view setNeedsLayout];
        self.splitViewController.delegate = nil;
        self.splitViewController.delegate = self;
    
        [self.splitViewController willRotateToInterfaceOrientation:[UIApplication    sharedApplication].statusBarOrientation duration:0];
    
     //also put your `MPMoviePlayerController` Fullscreen Method here
    }
    
    #pragma mark - Split view
    
    -(BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
    {
        return self.IShide;
    }
    - (void)viewDidLoad
    {
    
        UIBarButtonItem *Fullscreen = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"FullScreen", nil) style:UIBarButtonItemStylePlain target:self action:@selector(hideMaster:)];
         [self.navigationItem setRightBarButtonItem:Fullscreen animated:YES];
        [super viewDidLoad];
    
    }
    

    while you click on the Fullscreen Event of you MPMoviePlayerController call this Delegate with this Event as par you hide and show MasterViewController.

    Code OUTPUT is

    enter image description here

    0 讨论(0)
提交回复
热议问题