简体   繁体   中英

Initial steps to be followed for making an Universal iOS application

I am just about to start a universal iOS application. I want to make this application using interface builder only.

Can some one suggect how can I arrange the two nib files? Whenever I create a class only one xib file is created, but I want two xib files, one for iPhone and the other for iPad application as this a universal application.

Also can you suggest which approach would be better ie making UI for this universal application through interface or using coding.

Just add another xib file to the project. You can start by making a copy of the first version you make, or with a blank xib.

To ensure correct xib is loaded at runtime you have a few options. I prefer to overload nibName on UIViewController, but you can also just call initWithNibName:, passing the correct nib name.

If you overload nibName, it might be something like this:

- (NSString*) nibName
{
   return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ? @"myphonenib" : @"mypadnib";
}

Personally given a choice, I prefer using xib, as the purpose of them is to "hide" GUI code making "function" code uncluttered..also "WYSIWYG" UI design kicks it for speed of development.

As for adding XIB...do As TomSwift suggest, just add them later

or as I did, do them on bulk later...ie

  1. develop iphone bits first
  2. Make copy of project
  3. Convert copy to iPad
  4. Rename Appdelegate & xib with your naming standard eg *iPad suffix
  5. Retrofit copied into your universal original.

(Note making sure you get all references changes and correct can be tidious & backup everything :)

Good luck.

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