简体   繁体   English

展示没有情节提要的模态视图控制器

[英]presenting a modal view controller without storyboard

I have created a custom UIWebView to present a login page. 我创建了一个自定义UIWebView来显示登录页面。 I am able to get this to show by adding it as a subview. 我可以通过将其添加为子视图来使其显示。 But I would like to present this modally and programatically without the use of a storyboard! 但是我想以模态和编程的方式来呈现这个故事,而无需使用情节提要!

Put it in an otherwise empty view controller, and then call 将其放在否则为空的视图控制器中,然后调用

[self presentViewController: animated: completion:]

in the view controller you're wanting to present it from. 在视图控制器中,您想从中显示它。 When you're done, you can call 完成后,您可以致电

[self dismissViewControllerAnimated: completion:]

to get rid of it again. 再次摆脱它。 This message can be sent to either the presenter or the presented view controller, though in either case it ultimately is the presenter which responds. 该消息可以发送给演示者或演示的视图控制器,尽管在任何一种情况下最终都是由演示者做出响应。

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

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