query: tag:IB

どこが違うのか気になったのでメモ。
Window-based ApplicationをView-based Applicationと同じところまで持っていく作業を書き出してみます。

※ Xcode 4.1で動作確認しています。

###Window-based Applicationを作成

###RootViewControllerを作成
File - New - New FileでUIViewControllerテンプレートを選び、RootViewController(.h, .m, .xib)を作成する

###Interface Builderで作業
MainWindow.xibを開く
View - Utilities - Show Object Library を開いて、

  1. View ControllerをDrag & Drop

View - Utilities - Show Identity Inspector を開いて、

  1. 先にDropしたView Controllerを選択
  2. Custom ClassのClassをRootViewControllerに
  3. (LabelをRoot View Controllerに)

View - Utilities - Show Attributes Inspector を開いて、

  1. View ControllerのNIB NameをRootViewControllerに

View - Assistant Editor - Show Assistant Editor を開いて、

  1. AppDelegateクラス(h)を開く
  2. IB上でoptionキーを押しながらRoot View Controllerを選択、(hファイル上まで)DragしてInsert Outlet Connectionを追加(Name:viewController)

下記のようにコード生成されます:
rails>>
@interface RootViewControllerProtoAppDelegate : NSObject {
RootViewController *_viewController;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet RootViewController *viewController;
<<--

###エディタでの作業
AppDelegateクラスのhで、@classを追加:
rails>>
@class RootViewController;
<<--

AppDelegateクラスのmで、#import、さらにself.viewControllerをself.window.rootViewControllerに
rails>>
#import "RootViewController.h"

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    // Override point for customization after application launch.
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
    }
    <<--

厳密に言うと、View-based ApplicationではviewControllerの宣言のされ方が若干違います。そこは各自確認下さいませ。。
作業をしてみてIB経由でクラスにViewController変数を追加するのはやったことなかったので、とても勉強になりました :)

posted by satoko satoko on Tue 6 Sep 2011 at 15:33 with 0 comments
Contents rssrss
Leading Smart TV App Development Companies | USA | 4 Way Technologies
Apple TV Developer | TVOS Development | USA | 4 Way Technologies
光ファイバーを二次元振動させて走査するAR用ディスプレイ
因果の取り違え
Value Transformer
Swift2's defer for CoffeeScript
mongodb-3.0からcreateIndexのdropDupsが無くなったらしい
mongodb-3.0以降のWiredTigerの設定を動的に変更する方法
一般楕円の高速生成アルゴリズムへの道標
farro mantecatoのレシピ
Tags
IB
Comments rssrss
https://listji.com/index.php?page=user&action=pub_profile&id=72479&item_type=active&per_page=16 https://listji.com/index.php?page=user&action=pub_profile&id=72479&item_type=active&per_page=16: As tһe premier furniture store аnd comprehensive f... 05/16 07:16
https://khvanchkaravino.ru https://khvanchkaravino.ru: Квартира мечты за 2 месяца — помогаем выбрать мебе... 05/16 05:06
https://www.tequilagames.com https://www.tequilagames.com: Thanks for finally writing about >something new an... 05/16 03:16
https://%EB%B6%80%EB%B9%84%EC%A3%BC%EC%86%8C.isweb.co.kr/ https://%EB%B6%80%EB%B9%84%EC%A3%BC%EC%86%8C.isweb.co.kr/: We absolutely love your blog and find a lot of you... 05/16 01:40
https://zgarcitul01.com https://zgarcitul01.com: Hi my loved one! I wish to say that this post is a... 05/16 01:10
https://pelnadobrego.pl https://pelnadobrego.pl: I love what you guys tend to be up too. This sort ... 05/15 22:11
https://bet365info.org/%f0%9f%92%b8-%d8%a8%d8%a7-%d9%87%db%8c%da%86%db%8c-%d8%af%d8%b1-%d8%a7%d9%86%d9%81%d8%ac%d8%a7%d8%b1-%d9%85%db%8c%d9%84%db%8c%d9%88%d9%86%d8%b1-%d8%b4%d9%88-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c/ https://bet365info.org/%f0%9f%92%b8-%d8%a8%d8%a7-%d9%87%db%8c%da%86%db%8c-%d8%af%d8%b1-%d8%a7%d9%86%d9%81%d8%ac%d8%a7%d8%b1-%d9%85%db%8c%d9%84%db%8c%d9%88%d9%86%d8%b1-%d8%b4%d9%88-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c/: درود، بنده امروز اتفاقی در اینترنت با این وبسایت آ... 05/15 21:26
https://linklist.bio/jutawanbetlogin https://linklist.bio/jutawanbetlogin: Hi there, You've done an excellent job. I will ce... 05/15 21:20