1

I had created an iPhone app long time back. Now I want to kind of convert the same into an iPad app (the code would more or less remain the same, I only want to redesign the xib for iPad size).

Now I am using XCode 4 and after opening the app, I changed the devices to iPad. But my .xib are still showing iPhone size. It created an iPad folder (just like Classes/Resources/Products...).

Also to add, the app now opens an iPad simulator, but let's say I have a UIWebView which just stretches to iPhone size (as in IB) and not the complete iPad size...

How and where do I redesign the xib for iPad ? What are the updates to be made when we just change the devices from iPhone to iPad ? Also I guess an iPhone app would work on iPad (using 2x), but the reverse is not true.

halfer
  • 19,824
  • 17
  • 99
  • 186
copenndthagen
  • 49,230
  • 102
  • 290
  • 442
  • Are the newly created xibs showing up in iPhone size inspite of selecting the "for iPad" during creating ? – Shanti K Nov 30 '11 at 04:17
  • No...The xibs are the old ones...I am doing it for the first time...so not sure if it would auto convert to iPad size... – copenndthagen Nov 30 '11 at 04:19

2 Answers2

2

You should look into creating a Universal app which basically has shared code and libraries for the iPhone and iPad but different view layers (views or XIBs).

In that model you have different interfaces for both which you should. The paradigms are different - in iPhone you have small real estate so you have navigators that drill in and pop out. In iPad, you have more real estate so you have master/detail splitter views with pop-over controls. As you pointed out, even the web views are different sizes at a minimum.

If you start fresh you can create a universal app and get a feel for how it's laid out. File, new project, iOS, pick app type, next. For device family select Universal.

If you are converting, there's some resources out there. Here's some:

http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html

How to convert iPhone app to universal in xcode4, if I previously converted, but deleted MainWindow-iPad?

Convert simple iPhone app to Universal app

Community
  • 1
  • 1
bryanmac
  • 38,941
  • 11
  • 91
  • 99
  • So by Universal app, you mean that the same app would run both on iPhone and iPad...Is the only difference the .xib between the 2 devices ? – copenndthagen Nov 30 '11 at 04:29
  • Also while I see MainWindow-iPad.xib, I also have 2 other .xib files with iPhone layout (ListViewController.xib and DetailViewController.xib)....So will I need to manually recreate them for iPad ? – copenndthagen Nov 30 '11 at 04:31
  • Yes - that's the idea. That's also one of the key principles behind MVC where it's good to get almost all code out of the view layers. If you can push most of your business logic does to the models/shared APIs, then recreating the thin view is not a big deal. Of course, if you have a view that's appropriate for the iPad or iPhone (resizes and handles size layout well), nothing says you can't launch that from an iPad or iPhone view. but, in the universal app, you have control over what gets shown in each device explicitly. – bryanmac Nov 30 '11 at 04:49
  • I am slightly confused reading the various links which you have referenced....My simple question is if I create a Universal app (single app working on iPod/iPhone/iPad), from my side, can that be completely handled by updating the XCode settings (Build/plist,etc) and NO CODE change would be needed at all...Is that correct ? My view is simple (mainly UITableView, UIWebView and iAd) – copenndthagen Nov 30 '11 at 06:26
  • Also the article on http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html seems to be very old (more than a year back)....So hope it is applicable even currently with XCode 4.. – copenndthagen Nov 30 '11 at 06:29
  • OK - concerning the views, if there simple enough and work on both then updating the build settings may be enough. I was approaching it more from a general stand point - I think most folks should step back and think - hey, what does iPad have to offer with more surface area and should I rethink the interactions rather than simply porting over. I guess it depends on the app type. I think many of the things in the useryourloaf article (such as info plist changes etc... still apply but I added some XCode4 links too. – bryanmac Dec 01 '11 at 00:07
  • Also - there was a WWDC video specifically on that topic of moving to iPad and they ported an app. If you have a membership, you may want to look at those videos. If I find which one, I'll append my answer. – bryanmac Dec 01 '11 at 00:08
0

I find it easiest to open the xibs in the separate Interface Builder that came with previous (3.2?) XCode and use its "convert to iPad using autoresize masks" option. Then I include the new separate XIBS in the project and do conditional loading (eg - use the UI_USER_INTERFACE_IDIOM() makro to load one xib or another.)

Peter Sarnowski
  • 11,900
  • 5
  • 36
  • 33