我有自定义导航栏
,内容是一个按钮栏
我需要创建从我的栏按钮到我的自定义导航的 segue,类型为 present modally
但不是通过 Storyboard以编程方式
这项工作但 segue 类型是 push
self.navigationController?.pushViewController("", animated: true)
我应该如何使用 模态呈现
获取它
最佳答案
这是一个使用 NavigationController 模态呈现的简单解决方案。
yourviewcontroller *myviewc= [[yourviewcontroller alloc] init];
[self presentViewController:myviewc animated:YES completion:nil];
如果你有一个导航 Controller ,第二个。
let myvc= self.storyboard!.instantiateViewControllerWithIdentifier("MyViewController") as! ViewController
let navc= UINavigationController(rootViewController: myvc)
self.presentViewController(navc, animated:true, completion: nil)
您只需为您的按钮创建一个 IBAction。本教程可以帮助您做到这一点 IBAction
希望对您有所帮助!
关于ios - 通过代码以模态形式使用 segue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39062036/