しめ鯖日記

swift, iPhoneアプリ開発, ruby on rails等のTipsや入門記事書いてます

ActionSegueの動作を確認する

ActionSegueの動作を確認してみました。

f:id:llcc:20170919144335p:plain

UINavigationControllerにセットされているController

まずは、下のようにUINavigationControllerにセットされているControllerからのSegueの挙動を確認してみました。

f:id:llcc:20170919144624p:plain

Show

UINavigationControllerのpushメソッドを呼んだ時と同じ挙動になりました。

f:id:llcc:20170919144820p:plain

Show Detail

UINavigationControllerのpushメソッドを呼んだ時と同じ挙動になりました。

Present Modally

UIViewControllerのpresentメソッドを呼んだ時と同じ挙動になりました。

Present As Popover

UIViewControllerのpresentメソッドを呼んだ時と同じ挙動になりました。

UINavigationControllerにセットされていないController

今度はUINavigationControllerにセットされてないControllerの挙動を確認してみました。

f:id:llcc:20170919145034p:plain

Show, Show Detail, Present Modally, Present As Popover

全て、UIViewControllerのpresentメソッドを呼んだ時と同じ挙動になりました。

コード上でUINavigationControllerにセットされたController

コード上でUINavigationControllerにセットされたControllerの挙動も確認しました。

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.makeKeyAndVisible()
        if let c = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() {
            
            window?.rootViewController = UINavigationController(rootViewController: c)
        }
        return true
    }
}

Show, Show Detail

UINavigationControllerのpushメソッドを呼んだ時と同じ挙動になりました。

Present Modally, Present As Popover

UIViewControllerのpresentメソッドを呼んだ時と同じ挙動になりました。
Storyboard上でUINavigationControllerにセットした場合と同じ動きをしました。