翻转视图时隐藏视图控制器的视图
我的应用程序中有 3 个视图。主视图有 2 个按钮,选择后会显示第二个视图(同样有按钮并显示带有图像的第三个视图)。我在第二个视图中有一个主页按钮。当按下时我想显示主视图。如果我将第二个视图添加为子视图
[self.view addSubview:secondViewController.view]
我可以做到这一点,但每当第二个视图翻转以显示第三个视图时,我可以在翻转时看到主视图。
现在,如果我添加第二个视图,如下所示 self.view = secondaryViewController.view 那么按下主页按钮时我没有要显示的主视图。
当第二个视图翻转显示第三个视图时,如何隐藏主视图?
I have 3 views in my app. Main view has 2 buttons and when selected it displays 2nd view(which again has buttons and displays a 3rd view with images). I have a home button on second view. When pressed I want to show the main view. I can do this if I add the 2nd view as subview
[self.view addSubview:secondViewController.view]
But whenever 2nd view flips to display the 3rd view, I can see the main view while it is flipping.
Now if I add 2nd view as below
self.view = secondViewController.view then I dont have the main view to display when the home button is pressed.
How can I hide the main view when 2nd view is flipping to show 3rd view?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也许可以在翻转之前将主视图的 alpha 属性设置为 0,在翻转后将其设置为 1。
我不确定您的应用程序是什么样子,但听起来您正在免费复制基于导航的应用程序为您提供的许多行为。只是一个建议。
You might be able to just set the main view's alpha property to 0 before you flip and 1 after you flip back.
I'm not sure what you're app looks like, but it sounds like you're reproducing a lot of behaviour given to you by navigation-based apps for free. Just a suggestion.