[英]segue after login with Facebook Swift ios
登錄成功登錄facebook后,我正試圖推送另一個視圖。但是我無法理解我該怎么辦。可以幫助我嗎?
當您通過Facebook完成登錄時,通常,您將有兩種方法來打開其他視圖控制器
如果已配置segue,請使用以下代碼
self.performSegueWithIdentifier(“identifier”,sender:self)
如果要使用StoryBoardId初始化viewController,請使用以下代碼
讓viewController = self.storyboard!.instantiateViewControllerWithIdentifier(“StoryBoardID”)作為UIViewController \n self.presentViewController(viewController,animated:true,completion:nil)
這是swift 3的更新,Xcode 8:
要使用StoryBoardId初始化viewController:
let viewController = self.storyboard!.instantiateViewController(withIdentifier: "StoryBoardId") as UIViewController
self.present(viewController, animated: true, completion: nil)
確保您在主線程中執行上述操作。
通過在Identity Inspector中向其添加Storyboard ID來設置第二個視圖。 然后這樣稱呼它:
let storyboard = UIStoryboard(name: "YourStoryBoardID", bundle: nil)
let secondView = storyboard.instantiateViewControllerWithIdentifier("YourStoryBoardID") as UIViewController
self.presentViewController(secondView, animated: true, completion: nil)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.