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

タブバー付き画面にするには? - タブバーの設定

Icon comment count 0
Icon stock count 0

1 タブバーの設定

サンプル:33/ThumbnailShowToPreview-17を引き続き拡張していきます。

1.1 UITabBarControllerの用意

まず、最初にUITabBarControllerインスタンスを作り、ViewControllerとPreviewControllerを並列で管理してみる事にします。

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

↓ AppDelegate.swift サンプル:33/ThumbnailShowToPreview-18
class AppDelegate: UIResponder, UIApplicationDelegate {・・・
    func application(application: UIApplication, 
            didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        ↓ストーリーボードから作られたViewControllerを取り出す
        let viewController = self.window!.rootViewController!
        ↓UITabBarControllerを作成
        let tabBarContro

出典情報

Medium

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

  • 著者: 國居 貴浩

コメント

    コメントはありません