How to make a .xib file in an empty project to be shown


#1

what are the steps and codes that makes a .xib file appear once an application lunches?
Lets say I create an empty application and I add a .xib file… how I can get that xib file to appear once the app did finish lunching?
I followed a single view application codes and files but it just wont run the xib file.

---------- Update ------------
Well :frowning: the question is awkward now, Chapter 7 already explain everything. I asked the question too fast but the link to youtube’s video down there is also another method of doing that :sunglasses:


#2

An .xib file does not appear, only the root (top) view in it does after a view controller loads the xib file.
After an application launches, you can load an xib file that you have created.
To do this, you create a view controller, make it the owner of the xib file, and connect its view outlet to a view (which becomes the top view) in the xib file.

You should read these references:

  • View Controller Programming Guide for iOS
  • View Controller Catalog for iOS

#3

An .xib file does not appear, only the root (top) view in it does after a view controller loads the xib file.
After an application launches, you can load an xib file that you have created.
To do this, you create a view controller, make it the owner of the xib file, and connect its view outlet to a view (which becomes the top view) in the xib file.

You should read these references:

  • View Controller Programming Guide for iOS
  • View Controller Catalog for iOS[/quote]

Hey, Tnx for reply
I followed everything you mentioned, Question: In single View Application there is a “view” outlet that .xib file is linked to through file’s owner, where does that Outlet defined ? coz I cannot see it in ViewController or App Delegate…


#4

That outlet is buried deep inside the view controller and you don’t need to see it. If you need the corresponding view, you can ask the view controller for it.


#5

Well I found an answer for that, I will share it so everyone can use
These are steps :
Make File’s owner an Instance of UIApplication
Add an Object to .xib file and make it an Instance of the App Delegate (You won’t need ViewController Currently)
Make your window a delegate and set the property of window in app delegate as an Outlet and link it to the window in xib file (ctrl + click and Drag).
Project Summary set the main interface to the .xib file’s name.

Here is the source : http://www.youtube.com/watch?v=sROdA4w4x9Y