Iphone – How to link a .xib file to a class file with Xcode 4

ipadiphonexcode4xib

have started a universal project under the new Xcode4. My Application works on both iPhone & iPad devices but not well design for the iPad. I have 2 .xib file for the MainWindow: MainWindow.xib (iPhone device) & MainWindow-Ipad.xib (iPad device). But only one .xib file for my MainView: MainView.xib.

So I'm trying to create a specific .xib file for the iPad Device:

New file > User interface > View -> next -> device family : iPad -> MainView-iPad.xib -> save

And of course, there is nothing connected,no referencing outlet, no link to any class.

I check each thumbnail of my new MainView-iPad.xib in order to link it to my MainViewController class without success !?

Where or how can I link it to my MainViewController class?
Thanks in advance.

Best Answer

The correct answer was given by user763308:

To link a .xib to a class under Xcode4:

  1. Open your .xib.
  2. In placeholder: select File's Owner.
  3. In the third thumbnail:"Identity Inspector" of the right panel, edit the "Custom Class" field and enter the name of your class.

I also then had to:

  1. Click the root view under Objects.
  2. Click the last tab: "Show Connections".
  3. Drag "New referencing outlet" to "File's Owner" and select "view".
Related Topic