iPhone - How to transform an iPhone only app to universal app? - iphone

how can i transform an iPhone only app to an universal application?
EDIT : FOUND SOLUTION
If you want to have the "Upgrade current target to iPad" option selected, you must have Target Device Family set to iPhone only, not iPad/iPhone. It works for me!

If you want to do it manually, first create a dummy/template Universal app, look at the differences between it and your app, and change your app to eliminate those differences. Among the steps:
Create iPad subdirectories.
Create suitable xibs for the iPad in that subdirectory. Interface Builder has a menu item to convert generic .xibs automatically.
Modify your info.plist (add the NSMainNibFile~ipad key) to use an iPad xib for the iPad main window. Also add appropriate icons, etc. to this plist.
Either create new subclasses for the iPad, or use modify your existing subclasses to check the UI paradigm and select the appropriate UI subelements & sizes in code. You can check in code using something like:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
...
} else {
... // iPhone stuff, etc.
}
If you created new classes, plug them into the iPad xibs as needed.
Modify all your Target settings to build for iPad and iPhone.

"The first step is to select your target in Xcode, right-click and use the “Upgrade Current Target for iPad…” command. You will presented with a choice:
Select “One Universal application” and Xcode will do (some) of the hard work for us. The Apple guidelines warn against trying to manually migrate your target though to be honest it is hard to really see why. Also note that if your project has more than one target you can only run the upgrade task once. You will need to check all of your targets and adjust the build and Info.plist settings yourself."
http://useyourloaf.com/blog/2010/4/7/converting-to-a-universal-app-part-i.html

Related

Making two storyboards for iOS (iPhone and iPad)

Is it possible to make only one application and inside of it make two storyboards, one for iPhone and one for iPad? I don't like the idea of running the app on iPad and clicking the 2x button.
My idea was to create two storyboards and have a beginning class that would check if the device you are using is an iPhone or an iPad and then redirect to the according storyboard after. I think it is a good idea cause the code is the same.
create two different storyboards and name them so they are easily specified which is which. Then click on the file that allows you to change settings for your actual app. and change the build to universal, then specify which storyboard you want to use!
there is a storyboard setting for iphone and ipad
iPhone
iPad
Make sure the names of the storyboards are correctly set though
Even if you already made an app non universal, just change it to universal (target-->summary), then create a new ipad story board and make sure under target-->summary that the main iphone storyboard and main ipad storyboard are set to the right storyboards.
Did you try creating new Universarl XCode project? If you create Universal project, there will be two Storyboards(One for iPhone and another one for iPad) created by default. i think.
I had to do this in a project recently... so first you should navigate to your projects target then click the summary button in the top bar you will then see a bar that says "iOS Application Target" in there you will see a drop down menu with a title that says Devices select the universal option. Now add a storyboard for the iPad. Now go back to the projects target and scroll down to the "iPad Deployment Info" section and set your new storyboard as the main storyboard in the text field here you can also add the iPad icon and launch images. Now you are set up for creating a universal app!
its very simple, just do the app in universal and then go to the target and then info and then add the main storyborad file base name (iPad) then build and run when iPhone is run to its show iPhone and when iPad run so show as iPad.

convert iphone App to IPad

I just completed one app in iPhone, now I wants to create same app for both iPhone and iPad.
I am new in iPhone, So don't know exact what to do?
1) create the new project and select Universal option, and copy paste all code
2) modify this app for both.
How to add xib for iPad?
thanks
Maybe this blog post gives you a quick overview, when you want to convert. Otherwise you can create a new project, of course, and copy your code.
You are correct,
Select the Universal option.
Transfer code from the existing iPhone project to the new project.
NOW,
Make the xib files for iPad, and make the connections (IBOutlets).
Wherever you need platform specific features (eg. Popover, Split ViewController etc for iPad), put an IF statement to handle the device specific features.
Select View From User Interface Option after that choose iPad from Device Family. This will create Xib for iPad.And then in Files Owner connect your class.

Develop iPad Version or iPhone Version first?

I have just finished developing an iPhone app and now I wish to make it a Universal App. I'm having issues incorporating a UISplitView into my current code to accommodate multiple detail views. I have looked at Apple's MultipleDetailViews sample code and have tried to insert into my project but it's becoming more of a headache than it should.
I'll copy all the project files from Apple's MultipleDetailViews sample code into my project, adjust my app delegate to check to see if an iPad's running, set the window to add a subView of splitViewController.view, but all I get is blank white screen when I build and run.
So my question is, do I develop the iPad version from a new project and then add my iPhone project files when I'm done?
OR
Do I make a separate iPad app and forget the whole Universal App?
Thoughts and suggestions would be much appreciated.
I would start with a Universal Project and generate content for the iPad, I've found downsampling easier than upscaling :). Try and make everything generic (based off the view height and width). This will make conversion to the iPhone/iPod easier.
I think there is more to creating a Universal build from the outset than just checking for iPad view.
You need to set the project up as a universal build in the build settings. I know default projects that are universal create a group of folders with a main view for iPhone and iPad. You will need to create separate views for iPhone and iPad.
I would create a dummy project that is universal and compare settings and default values. Try adding these to your project and see if you have better results.
But I wouldn't think you should put one before the other. Build the one you think you will have the most success with first, then if you still need it, build out for the other. Good luck.

Downgrading iPad app to iPhone app

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
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.

Customize iPhone view for iPad

I have converted a very simple iPhone app to Universal app. Now I need to customize the view on the iPad to use a higher resolution image for the background, move and resize some labels, etc.
How can I do it without changing the iPhone version? I can see that there is a new MainWindow-iPad.xib, but when I open in IB, it looks empty.
Thanks.
Did Xcode create other iPad specific nib files for you? If you are adding your view(s) to the mainWindow at application launch it will be those that need modifying.
If you are adding images programatically, you can use different resources per target. When you drag a resource into your Xcode project (say background.png) you can select which target to apply the resource to. So if you have an iPadResources folder, you can put your larger background.png into it and add it only to the iPad version. (Remember to GetInfo on the old resource, go to Targets and untick the iPad target).
Hope this helps