0

我使用 xib 文件创建了一个名为 Login 的控制器。我想让它成为开始屏幕。所以在我的应用委托中,

H 文件:

UIWindow *login;
@property (nonatomic, retain) IBOutlet UIWindow *login;

M 文件:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.
[self.login makeKeyAndVisible];
    return YES;
}

我错过了链接到界面生成器之类的东西吗?我得到一个空白屏幕

4

1 回答 1

0

I think you need to create a UIViewController subclass together with your login nib file and then alloc and init this view controller so that you can then make the UIViewController's view the main view.

Even better would probably be the use of storyboard, where you can easily set the initial view controller all on your storyboard.

There is a good Tutorial about iOS Storyboards. I personally find the use of storyboards very convenient. In this SO question I listed some of the pros and cons of storyboards (IMHO):

Does storyboard eliminate the need for .nib

于 2012-05-01T10:37:11.050 回答