Вопрос

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.

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top