storyboardを手動で画面遷移

「storyboardを手動で画面遷移」の編集履歴(バックアップ)一覧はこちら

storyboardを手動で画面遷移」(2015/09/04 (金) 11:52:33) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

遷移先に移る方法 func tapBtn(sender: UIButton) { let nextView = NextViewController() nextView.modalTransitionStyle = UIModalTransitionStyle.CrossDissolve self.presentViewController(nextView, animated: true, completion: nil) } 戻る方法 func tapBtn(sender: UIButton) { dismissViewControllerAnimated(true, completion: nil) } 別な方法も func next(view: UIViewController, resourceId: String) { var next : AnyObjext! = view.storyboard!.instantiateViewControllerWithIdentifier(resourceId) (next as! UIViewController).modalTransitionStyle = UIModalTransitionStyle.CrossDissolve view.presentViewController(next as! UIViewController, animated: true, completion: nil) } 呼び方 next(self, resourceId: "vNext") ※StoryBoardで、UIViewControllerにClassとModuleとStoryboard IDの3つを設定済みであること -viewDidLoadで呼び出すと以下のワーニング発生する 「Presenting view controllers on detached view controllers is discouraged」 以下で回避可能 self.view.window?.rootViewController!.presentViewController(nextView!, animated: true, completion: nil) もしくはviewDidLoadで呼ばないで以下で呼ぶようにする。こっちが正解か? afterXXXLoad 2015/8/18

表示オプション

横に並べて表示:
変化行の前後のみ表示: