0

We can upgrade an iPhone project to iPad project as mentioned in the link: http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/120-Building_and_Running_Applications/building_and_running_applications.html

But, I am having an project that is created for iPad. Now, I want to create another target for iPhone (supporting OS same as iPad). How do I do this?

Thanks and Regards, Deepa

spd
  • 2,114
  • 1
  • 29
  • 54
  • Duplicate of http://stackoverflow.com/questions/3216896/downgrade-iphone-ipad-app-to-iphone-only-xib – Pascal Jan 13 '11 at 10:29
  • But, I had not converted from iPhone to iPad. I created an iPad project. Now, I want to support same application in iPhone also. I can create separate target for iPhone and manually add the files to this project, modify nibs. Is there any method to create such target that automatically adds all the files to iPhone target and I just have to modify the nibs. – spd Jan 13 '11 at 10:47
  • Try duplicating the target and somewhere in -applicationDidFinishLaunching set the window's frame to your screen bounds. This should force the main window to become smaller thus autoresising any other view you will throw onto that window. – krzyspmac Jan 13 '11 at 11:02
  • There are 20-25 nibs in my project. So, I prefer manually modifying the view/window size in nibs. The problem is: I have around 1000 files(source and resources) in my project. When I create a target for iPhone, manually I need to add each of this to iPhone target. I might miss some of the source/resource files if there are hierarchies. To avoid this risk, I wanted a method that adds all the resources to iPhone target when I create iPhone target. Is there any way? – spd Jan 13 '11 at 11:22

1 Answers1

0

You probably do not want to create a new target for iPhone. What you want is to have a single target that creates a universal application that runs on both iPad and iPhone/iPod touch.

First go to the project settings and change the setting for "Target Device Family" from "iPad" to "iPhone/iPad".

Secondly you will also need two MainMenu.nibs, one for iPad and one for iPhone. You do this in the Info.plist for your target. The key NSMainNibFile should name the nib for iPHone, add a key named NSMainNibFile~iPad to name the nib for iPad.

Now the app is ready to run on both devices, (until you try to use UIPopoverController or other iPad specific class on the phone). Rest of the work is just to make it pleasant, one view at the time.

Use the run-time check [UIDevice currentDevice].userInterfaceIdiom to check at run-time what kind of device you are running. To choose different nibs to load, and other user experience differences.

PeyloW
  • 36,742
  • 12
  • 80
  • 99