UIPopoverViewController 内的模态 UINavigationController
这是我的情况:
我有一个 UINavigationViewController
(带有一堆 UITableViewControllers
),它位于 UIPopoverViewController
内。这是现在的样子:
然后其中一个按钮具有以下操作:
MyViewController *moveViewcontroller = [[MyViewController alloc] init];
moveViewcontroller.contentSizeForViewInPopover = self.contentSizeForViewInPopover;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:moveViewcontroller];
navController.toolbarHidden = NO;
navController.navigationBarHidden = NO;
navController.contentSizeForViewInPopover = self.navigationController.contentSizeForViewInPopover;
navController.modalPresentationStyle = UIModalPresentationCurrentContext;//to show it inside the popover
[self.navigationController presentModalViewController:navController animated:YES];
[navController release];
[moveViewcontroller release];
它显示导航控制器,但它不像第一张图片中的导航控制器那样嵌入在`UIPopoverController中。这就是我得到的:
不太好看,和之前的界面不太一致 有没有办法让我的模态导航控制器嵌入 UIPopoverController
?
基本上,我想实现一个与 iPhone 中的 Mail.app 类似的界面(当将电子邮件从一个文件夹移动到另一个文件夹时),但在弹出窗口内。
This is my situation:
I have a UINavigationViewController
(with a stack of UITableViewControllers
) which is inside an UIPopoverViewController
. This is how it looks now:
Then one of the buttons there have this action:
MyViewController *moveViewcontroller = [[MyViewController alloc] init];
moveViewcontroller.contentSizeForViewInPopover = self.contentSizeForViewInPopover;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:moveViewcontroller];
navController.toolbarHidden = NO;
navController.navigationBarHidden = NO;
navController.contentSizeForViewInPopover = self.navigationController.contentSizeForViewInPopover;
navController.modalPresentationStyle = UIModalPresentationCurrentContext;//to show it inside the popover
[self.navigationController presentModalViewController:navController animated:YES];
[navController release];
[moveViewcontroller release];
Which shows the navigation controller but it not embedded in the `UIPopoverController like the navigation controller in the first picture. This is what I get:
Not very nice and it is not consistent with the previous interface
Is there a way I can make my modal navigation controller be embedded in the UIPopoverController
?
Basically, I want to implement a similar interface as in Mail.app in the iPhone (when moving emails from one folder to another) but inside a popover.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为以模态方式呈现的
UIViewController
指定呈现样式。我使用以下代码执行此操作:
关键行是处理 modalPresentationStyle 的行 - 它强制模式视图控制器出现在 UIPopoverController 内
You need to specify the presentation style for the
UIViewController
you are presenting in a modal way.I do this using the following code:
The key line is the one dealing with the
modalPresentationStyle
- which forces the modal view controller to appear inside theUIPopoverController