0

I have made an iPhone application and currently it loads a xib specific for iPhone. Currently I drag drop the connections from xib to xcode for ibOutlet and ibAction.

Currently I have iphone.xib and it has MyLabel which is linked to an IBOutlet to a MyViewClass.

My question is how can I create iPad.xib, add MyLabel to it and link it to the same IBOutlet of MyViewClass.

Shamas S
  • 7,507
  • 10
  • 46
  • 58
  • Best way to figure this out is to a create a new universal project. Have look at code apple supply's for you and give it go doing it yourself in your project. – BooRanger Jan 28 '14 at 16:11
  • Correctly answered by Bot. Turns out I was not setting the name of the class as File's owner. – Shamas S Jan 28 '14 at 16:44

1 Answers1

1

Create a xib with your view, sized for the iPad. Set the class in the InterfaceBuilder to your class where the IBOutlet is. From there you can ctrl + drag to the IBOutlet.

I do this by selecting assistant editor (tuxedo looking icon in the top right of xcode). I then have my storyboard / xib on the left side and my class header file on the right. I then ctrl drag the element from the storyboard / xib to the class header file and it links them for me.

You can then use code to determine which xib you need to load.

Bot
  • 11,868
  • 11
  • 75
  • 131