使用操作按钮更改视图控制器 [英] Change view controller using action button
本文介绍了使用操作按钮更改视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 UIButton 切换视图控制器?这是我的代码:
How can I switch the view controller using UIButton? Here is my code:
@IBAction func scanAction(sender: AnyObject) {
//switch view controller
}
当我单击扫描"按钮时,它将进入登录表单.
When I click the Scan button, it will go to a login form.
我在 Main.storyboard 中的视图控制器是这样的
My view controller in Main.storyboard is like this
我应该如何进行?
推荐答案
我已经找到答案
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("nextView") as NextViewController
self.presentViewController(nextViewController, animated:true, completion:nil)
这篇关于使用操作按钮更改视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文