问题
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 video of that item on the detail-view.
I am using MPMoviePlayerController to play the videos.
If I press full screen icon, the player should fill the entire screen (master-view as well as detail-view, not just detail-view).
How could I do this? Please help!
回答1:
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
来源:https://stackoverflow.com/questions/18208410/fill-master-and-detail-view-in-full-screen-mode-of-ipad