親切すぎるiPhoneアプリ開発の本

テーブルとナビゲーション - ナビゲーションとの連携

Icon comment count 0
Icon stock count 0

1 ナビゲーションとの連携

サンプル:34/Table-08をナビゲーションバー付きに拡張します。

1.1 UINavigationControllerの準備

ステップ28でViewControllerをUISplitViewControllerに登録したように、AppDelegateの-application:didFinishLaunchingWithOptions:メソッドでUINavigationControllerを作り、私たちのViewControllerが設定されているrootViewControllerプロパティを差し替えます。

↓ AppDelegate.swift サンプル:35/Table-09
class AppDelegate: UIResponder, UIApplicationDelegate {・・・
    func application(application: UIApplication, 
           didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        //  ストーリーボードから作られたViewControllerを取り出す
        let viewController = self.window!.rootViewController!
        //  viewControllerをルートに設定してUINavigationControllerを作成。
            UIWindowのrootViewControllerとして設定する
        self.window?.rootViewCont

出典情報

Medium

親切すぎるiPhoneアプリ開発の本

  • 著者: 國居 貴浩

コメント

    コメントはありません