Fill master and detail view in full screen mode of iPad

爱⌒轻易说出口 提交于 2019-11-30 05:31:21

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!