Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
283 views
in Technique[技术] by (71.8m points)

iphone - How to link a .xib file to a class file with Xcode 4

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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".

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...