简体   繁体   中英

Updating iPhone app to Universal: IBOutlets

First off, I will say i've spent 6 hours on this topic and have read everything the internet has to provide, which is why i came here.

I have converted to Universal, Xcode created the MainWindow-iPad.xib and everything seems fine. Here are my questions:

1) What are the naming conventions for new iPad-specific xibs? Xcode created "-iPad" but i believe im supposed to be making them "~ipad". Why the difference?

2) (MOST IMPORTANT) After creating several "~ipad" xibs, Xcode seems to know to load these. So I'll copy the content in say, "RootViewController.xib" and paste it in "RootViewController~ipad.xib". THIS IS THE PROBLEM : this new ~ipad xib has no outlets or referencing outlets! I can't link the buttons on my page to anything. How do i do this without having a separate ~ipad .m and .h for everything?

Thank you guys for your help! I'm going to write a tutorial on this once I get this all working.

Just set the class of that ~iPad nib to be the same classname as the cooresponding iPhone nib. This is done in the inspector in Interface Builder. You may have to connect the outlets back up depending on the order you do things. I would think that if you copy the objects from the iPhone nib to the iPad nib AFTER you set the class, then the outlets would stay wired up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM