Segue Out of Navigation Controller

综合技术 Hello, buddy! (源链)

I am trying to leave the initial view controller, and go into the blank view controller. That is fine, but that would make the blank view controller also part of the navigation controller, which is not what I want. I want to segue out of the view controller.

In the view controller I try to segue out of, it pops it self, and when I try the method in the view will appear of the target view controller, self.navigationController?.topViewController returns itself, but self.navigationController?.popViewControllerAnimated(animated) doesn’t work

If you have a navigationController do

self.navigationController?.popViewControllerAnimated(false)

Otherwise do

self.dismissViewControllerAnimated(false, completion: nil)

Update

Go to your Storyboard, select the ViewController you want to navigate to and add a storyboard id. Make sure the click “Use Storyboard ID”

Go to the class you want to navigate from and add the following code

let storyboard = UIStoryboard(name: "Main", bundle: nil)
// vc is the Storyboard ID that you added
// as! ... Add your ViewController class name that you want to navigate to
let controller = storyboard.instantiateViewControllerWithIdentifier("vc") as! ViewController
self.presentViewController(controller, animated: true, completion: { () -> Void in
})

Add this code in the action that you use when you want to navigate.

您可能感兴趣的

Recovering image memory usage My app has problems with memory management. I have used instruments and have noticed that allocation just builds itself up until it crashes. I am usi...
Trying to animate a static resource SolidColorBrus... What I'd like I want to reuse some styles across multiple UserControl types. I would like the background of some Border controls to flas...
从Storyboard到DIY实现一个漫画生成器-01 Storyboard 谷歌的安卓应用 用户只需拍摄一段视频并将其加载到 Storyboard 中即可将视频转换为单页漫画的布局。该应用会自动选择有趣的帧,并将其应用于6种视觉样式中的一种。生成的漫画大约1.6万亿种不同的可能性! ...
UWP 图片模糊 先看一下效果: 这是微识别的个人中心页面,顶部有头像,以及背景图片模糊。 要实现这样的效果,有两种方法。 第一种麻烦点,也是我现在用的。想看简单的,翻到最后 1、 首先看一下xaml代码: ...
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » Segue Out of Navigation Controller



专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录