views:

110

answers:

3

Can any one suggest how I can build Universal app for iPad as well iPhone. What all things I should take care of ? How to take care of resource images used ? Is it possible to have same code base should work for iPad as well iPhone.

A: 

Just use the latest iPhone SDk 4.0 it will resolve the problem

moon
+2  A: 

In the Target->Project->getInfo->Build->target family-> select iPhone/iPad

And make the conditions everywhere whereever you set frame and also the resolution of the image required by iPAD is high.. so as per condition check whether its running on iPad or iPhone and based on that set your frame and image.

hAPPY cODING...

Suriya
@Surya: Do I need to create separate nib files? If the images are embedded into nib file but not loaded programtically how to dealt with this situations ?
Unicorn
For that you have to create seperate nib for both iphone and ipad and while calling then you have to call the nib accordingly but the condition part gonna remain samehAPPY cODING...
Suriya
+1  A: 

After creating your universal app (see @Suriya's post above) you should figure out in the app delegate whether you have an iPad or iPhone. Here is a simple tutorial to do just that.

Yes, you will need separate nibs and images for an iPad app. But, no, not all the code has to change. You can simply use class inheritance.

Example:

You have a MyTableViewController.h and .m file that work on the iPhone. This table has a custom cell, MyTableViewCell. Now you want your iPad app to get the same information, but display a larger table and a larger table cell. You then subclass your iPhone classes like so: MyiPadTableViewController : MyTableViewController and MyiPadTableViewCell : MyTableViewCell . This way you have access to all of your created functions in the parent class, but you can override how the information is displayed.

If you have a function - (void)doSomething:(id)foo; in your MyTableViewController class, you can use it in your MyiPadTableViewController class without writing any extra code, or override it if necessary. The point is you don't have to change code in two places, so it makes life a lot easier.

MishieMoo