1.跳轉到任一UIViewController var sb = UIStoryboard(name: "Main", bundle:nil) var vc = sb.instantiateViewControllerWithIdentifier("ChooseViewController") as
1.跳轉到任一UIViewController
var sb = UIStoryboard(name: "Main", bundle:nil)
var vc = sb.instantiateViewControllerWithIdentifier("ChooseViewController") as ChooseViewController
self.presentViewController(vc, animated:true, completion:nil)
2.從當前視圖跳轉到下一視圖
var vc = AnswerViewController()
self.presentViewController(vc, animated: true, completion: nil)
3.通過dismissViewControllerAnimated(completion:)返回上一個視圖
self.dismissViewControllerAnimated(true, completion:nil)
4.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
}
5.通過navigationController.pushViewController(animated:)方法
var webView=WebViewController()
webView.detailID=data.newsID
//取導航控制器,添加subView
self.navigationController.pushViewController(webView,animated:true)
6.通過 func popViewControllerAnimated() -> UIViewController! 彈出最上面的視圖,並返回下一個視圖控制器
7.通過func popToViewController(animated:) -> AnyObject[]!返回到navigationController視圖堆棧中指定的某一個視圖
歡迎完善。。。。