简体   繁体   English

UIViewController尝试以模态呈现

[英]UIViewController trying to present modally

Trying to present UIViewController modally but it is working with only pushviewconttoller statement only. 尝试以模态形式呈现UIViewController,但仅与pushviewconttoller语句一起使用。

 [navigationController pushViewController:_viewController animated:YES];

With presentModalViewController statement it shows only navigationbar that is it not done button not even UIView 使用presentModalViewController语句,它仅显示未完成的导航栏按钮甚至UIView

[navigationController presentModalViewController:self.viewController animated:YES];

Why is that? 这是为什么?

I think you should not try to present a view modally by specifying the navigation controller as its parent. 我认为您不应该尝试通过将导航控制器指定为其父视图来模态地呈现视图。 Try and present the view modally as an offshoot of your actual controller: 尝试将视图模态呈现为实际控制器的分支:

[myCtrl presentModalViewController:...];

I don't know in which context you are calling presentModalViewController ; 我不知道您在哪个上下文中调用presentModalViewController ; anyway, depending on the context, myCtrl could be self , or if you want that the modal view appear no matter which view controller is actually displayed you could try with: 无论如何,取决于上下文, myCtrl可以是self ,或者如果您希望模态视图出现而无论实际显示哪个视图控制器,都可以尝试:

[navigationController.topViewController presentModalViewController:...];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM