Where is MainWindow.xib in new Xcode project?

佐手、 提交于 2019-12-05 01:55:52

MainWindow.xib was kind of superfluous to begin with, keeping in mind that it doesn't really contain any "visible" components (thinking of the window as an invisible container) and that usually you don't need to modify it. (That said, I'm only a beginner in iOS development myself, so I would appreciate my observation being corrected if I'm wrong).

MainWindow.xib's role in the beta version has been replaced by code: compare the auto-generated (-)application:didFinishLaunchingWithOptions: of the same template in the current and beta version of Xcode, and you should be able to follow what's happening.

If you are using the iOS SDK beta please read the release notes and the "What's new in iOS" document. You can find the documents on developer.apple.com when logged in as an iOS Developer Program member.

I just created a blank tab bar project in Xcode 4 and the MainWindow.xib is there. Maybe you deleted it by accident. Try creating a new project from scratch, it should be there.

There's a nice video tutorial on Youtube explaining how to re-create MainWindow.xib from scratch:

http://www.youtube.com/watch?v=sROdA4w4x9Y

Yantao Xie

For the reason of MainWindow.xib been missed, you can refer to this answer. And you can refer to Is a MainWindow.xib truly needed in iOS application? for more discussion.

In fact, you need not a MainWindows.xib. You can look up the implementation code of your AppDelegate class's method:

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

which will tell you how you xib files are loaded and connected to the window.

And you should look up your main.m, you will find code like this

UIApplicationMain(argc, argv, nil, @"MyAppDelegateClassName");

or

UIApplicationMain(argc, argv, nil, NSStringFromClass([myAppDelegate class]));

rather than

UIApplicationMain(argc, argv, nil, nil);

This statement make your AppDelegate loaded.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!