在弹出窗口中呈现模态视图

在弹出窗口中呈现模态视图

本文介绍了在弹出窗口中呈现模态视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从弹出窗口中显示的视图控制器加载模态视图。模态视图加载但问题是它转换到主视图而不是弹出框内。这是我失踪的东西吗?我认为简单地从一个popc中的vc启动它会在同一个popover中呈现模态视图...

Im trying to load a modal view from a view controller that is displayed in a popover. The modal view loads but the problem is that it transitions into the main view and not within the popover. Is it something Im missing? I thought simply initiating it from a vc within a popover would present the modal view within the same popover...

代码没有什么特别的,如下:

The code is nothing special as bellow:

- (IBAction)myButton{
ModalVC *controller = [[ModalVC alloc] initWithNibName:@"ModalVC" bundle:nil];

[self presentModalViewController:controller animated:YES];
[controller release]; }


推荐答案

如果你添加

controller.modalPresentationStyle = UIModalPresentationCurrentContext;

在调用presentModalViewController之前:动画你的ModalVC应该显示在popover中。

before the call to presentModalViewController:animated your ModalVC should be displayed within the popover.

在弹出框中以模态方式显示内容的另一种方法是使用属性modalInPopover。

Another way to display something modally in a popover is to use the property modalInPopover.

这篇关于在弹出窗口中呈现模态视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:54