获取对 iPad Landscape 中 UISplitViewController 上下文中弹出的 UIPopover 的引用

发布于 2024-11-07 23:20:27 字数 1733 浏览 0 评论 0原文

这是关于如何关闭弹出窗口的关闭 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬花如无物 2024-11-14 23:20:27

好的,我知道了。

我使用了此处描述的通知方法的组合 关闭 UIpopover ..我从

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

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

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

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.

:-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文