获取对 iPad Landscape 中 UISplitViewController 上下文中弹出的 UIPopover 的引用
这是关于如何关闭弹出窗口的关闭 UIpopover 的后续问题。
我也有类似的情况,但它是在 Master Detail iPad 应用程序上下文中的 UIPopover。我基本上创建了两个导航控制器(这不是 CS193P 的推荐),一个用于主控制器,一个用于细节控制器。
在我的 AppDelegate 中,我有以下内容来设置我的 UISplitViewController
#pragma
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Creating the EpisodesViewController (used on both iPhone and iPad)
EpisodesViewController *navControllerRootController = [[EpisodesViewController alloc] init];
UINavigationController *masterNav = [[UINavigationController alloc]initWithRootViewController:navControllerRootController];
[navControllerRootController release];
masterNav.title=@"Episodes";
if ([self iPad]) {
EpisodeDetailViewController *detailViewController = [[EpisodeDetailViewController alloc]init];
UINavigationController *detailNav = [[UINavigationController alloc]initWithRootViewController:detailViewController];
detailNav.navigationBar.tintColor = [UIColor blackColor];
self.splitviewController = [[UISplitViewController alloc] init];
self.splitviewController.delegate=detailViewController;
self.splitviewController.viewControllers = [NSArray arrayWithObjects:masterNav,detailNav,nil];
[window setRootViewController:self.splitviewController];
[detailViewController release];
[detailNav release];
}else {
[window setRootViewController:masterNav];
}
[masterNav release];
[self.window makeKeyAndVisible];
return YES;
}
所以。问题是...如何获取对单击“剧集”按钮时出现的 UIPopover 的引用。我想做的是从另一个线程实现解决方案,但我没有(据我所知)对我的弹出窗口的引用,所以我可以忽略它。
[编辑]使我创建detailNav的方式与我创建masterNav的方式相同,以避免使主要问题变得模糊。
This is a follow up question to Dismissing a UIpopover regarding how to dismiss a popover.
I have a similar situation but its a UIPopover in the context of a Master Detail iPad application. I basically create TWO Navigation Controllers (this is off a recommendation from CS193P), one for the Master and one for the Detail.
in my AppDelegate, I have the following to set up my UISplitViewController
#pragma
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Creating the EpisodesViewController (used on both iPhone and iPad)
EpisodesViewController *navControllerRootController = [[EpisodesViewController alloc] init];
UINavigationController *masterNav = [[UINavigationController alloc]initWithRootViewController:navControllerRootController];
[navControllerRootController release];
masterNav.title=@"Episodes";
if ([self iPad]) {
EpisodeDetailViewController *detailViewController = [[EpisodeDetailViewController alloc]init];
UINavigationController *detailNav = [[UINavigationController alloc]initWithRootViewController:detailViewController];
detailNav.navigationBar.tintColor = [UIColor blackColor];
self.splitviewController = [[UISplitViewController alloc] init];
self.splitviewController.delegate=detailViewController;
self.splitviewController.viewControllers = [NSArray arrayWithObjects:masterNav,detailNav,nil];
[window setRootViewController:self.splitviewController];
[detailViewController release];
[detailNav release];
}else {
[window setRootViewController:masterNav];
}
[masterNav release];
[self.window makeKeyAndVisible];
return YES;
}
So. the question is... how do i get a reference to the UIPopover that appears when I click the "Episodes" button. What I'd like to do is implement the solution from that other thread, but I dont have a reference (that I know of) to my popover so I can dismiss it.
[Edit] made the way that I created the detailNav the same as the way I created masterNav to avoid clouding the main issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我知道了。
我使用了此处描述的通知方法的组合 关闭 UIpopover ..我从
in 发布通知我的主视图和我有一个指向 UIPopover 的实例变量,如下所述
纵向中的 UISplitViewController:如何以编程方式隐藏主弹出窗口? 我用它来实际关闭弹出窗口。
就像魅力一样。
:-)
Okay, I've got it.
I used a combination of the notification approach described here Dismissing a UIpopover .. I post th notification from the
in my Master view and I have an instance variable pointing to the UIPopover as described here
UISplitViewController in portrait: how to hide master popover programatically? which I use to actually dismiss the popover.
Works like a charm.
:-)