10

I started a new project in Xcode 4 using the TabBar template. I noticed that there was no MainWindow.xib file in the project.

  • Did Apple get rid of this file?
  • How can I access the Mainwindow without this file?
user
  • 121
  • 1
  • 1
  • 4

5 Answers5

4

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.

Aky
  • 1,777
  • 1
  • 14
  • 19
  • I should add that it's easy enough to recreate the MainWindow nib file if you need to; in fact it might be instructive to do so as it'll help you understand the app lifecycle better. If you need help, take a look at: [link](http://www.trappers.tk/site/) – Aky Jul 16 '11 at 11:43
2

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.

rastersize
  • 488
  • 3
  • 19
  • In fact, the Release Notes for XCode 4.2 are not on the website (the release notes there are about the iOS SDK 5). Instead, the release notes for your version of Xcode are in the .dmg file you downloaded, in the 'About Xcode.rtf' file. That being said, those release notes do not mention this change, so it's still a mystery to me as to why this has changed in Xcode 4.2 versus previous versions. Maybe this is the new recommended way to use a TabBarController (create and display it programatically)... – Guillaume Boudreau Jul 05 '11 at 14:21
  • That is correct, only it is not the in the Xcode release notes you should look. My statement was not entirely correct either though, the document to lookup is the "What's New in iOS" on the developer site. This is of course only true if you are using the iOS SDK beta. I've edited my original answer to reflect this. – rastersize Jul 18 '11 at 20:59
0

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.

Community
  • 1
  • 1
Yantao Xie
  • 12,300
  • 15
  • 49
  • 79
0

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.

edc1591
  • 10,146
  • 6
  • 40
  • 63
0

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

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

Michael Thiel
  • 2,434
  • 23
  • 21