.跳转到任一UIViewController
var sb = UIStoryboard(name: "Main", bundle:nil)
var vc = sb.instantiateViewControllerWithIdentifier("ChooseViewController") as ChooseViewController
self.presentViewController(vc, animated:true, completion:nil)
.从当前视图跳转到下一视图
var vc = AnswerViewController()
self.presentViewController(vc, animated: true, completion: nil)
.通过dismissViewControllerAnimated(completion:)返回上一个视图
self.dismissViewControllerAnimated(true, completion:nil)
.Modal Segue to channel Controller
通过在storyboard设计视图中,选择一个按钮,右键拖动到另一个视图,即可建立动作跳转,但需要重载func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!)方法,如下:
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
var channelC:ChannelController=segue.destinationViewController as ChannelController
channelC.delegate=self
channelC.channelData=self.channelData
}
.通过navigationController.pushViewController(animated:)方法
var webView=WebViewController()
webView.detailID=data.newsID
//取导航控制器,添加subView
self.navigationController.pushViewController(webView,animated:true)
.通过 func popViewControllerAnimated() -> UIViewController! 弹出最上面的视图,并返回下一个视图控制器
.通过func popToViewController(animated:) -> AnyObject[]!返回到navigationController视图堆栈中指定的某一个视图