如何在主视图之前显示次要视图?
我想让我的应用程序(在启动时)加载我在原始视图顶部创建的视图,然后当单击按钮时,顶部视图将消失并显示下面的主视图。我知道这非常简单,但我该怎么做呢?也许将视图推送到 viewDidLoad 中?
I'm wanting to have my app (on launch) load a view that I have created over the top of the original view, then when a button is clicked the top view will disappear and show the main view underneath. I know this is terribly simple, but how would I do this? Maybe push the view in viewDidLoad
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用导航控制器
Use a navigation controller
这可能非常简单。当用户单击按钮时,只需执行此操作
只需在委托中添加两个视图,然后在委托中执行此操作。
如果您愿意,只需在“第二个ViewController”中执行即可! self.view.hidden = YES;
听起来你只是在做一些简单的事情……不需要费心使用视图控制器。
您问如何显示第二个视图,就像这样..
希望它有帮助!
This can be incredibly simple. When the user clicks the button, just do this
Just add the two views in your delegate, and do that in your delegate.
If you prefer, just do it "in" secondViewController! self.view.hidden = YES;
It sounds like you're just doing something simple ...... no need to bother with a view controller.
You ask how to display the second view, just like this ..
Hope it helps!