在iPad的全屏模式下填写主视图和详细视图 [英] Fill master and detail view in full screen mode of iPad

查看:110
本文介绍了在iPad的全屏模式下填写主视图和详细视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的iPad应用程序中使用Master-Detail应用程序模板。

我有包含视频列表的主视图。当选择任何列表项时,它开始在详细视图上播放该项目的视频。

我正在使用MPMoviePlayerController播放视频。

如果我按全屏图标,播放器应该填满整个屏幕(主视图和详细视图,而不仅仅是详细视图)。

我怎么能这样做?请帮忙!

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!

推荐答案

你可以隐藏或显示 MasterViewcontroller 使用Delegate of UISplitViewController

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;

更新: -

示例代码: -

设置 DetailViewController.h中的一个 BOOL class

set One BOOL value in you DetailViewController.h class

@interface DetailViewController : UIViewController <UISplitViewControllerDelegate>

@property (nonatomic) BOOL  IShide;

并按照方法执行此操作 .M

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];

}

当您点击全屏事件时 MPMoviePlayerController 使用此事件调用此委托作为隐藏和显示MasterViewController的标准。

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

代码输出

这篇关于在iPad的全屏模式下填写主视图和详细视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆