how to convert ipad version app to iphone version? - iphone

Now I need to redesign an app(iPad version), it can run on iPad successfully .The targeted device family is iPad, and I want it run on iPhone.So I already changed the targeted family to iPhone, but it cannot run. It is because the size of the iPad and iPhone is different, so how can i make it successful to run on iPhone? Do I need to create a new xib for iPhone?How to achieve it?

Yes, you need to create new XIB's that are structured for the smaller interface. You will also need to determine in code what view you are loading for which device.
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
/* do something for the iPad */
else
/* do something for the iPhone */

Yes, you will need to create new /xibs for iPhone, an iPad App won't work on an iPhone like that. Not only the sizes are diferent, the ratio width/height is different too

If you really worked at it, you could use the xib file for both the iPad and iPhone. But first you have to make sure that your existing xib files don't have a "~ipad" in them, because if they do, they will only be loaded on the iPad and not the iPhone.
You may also want to make your app Universal instead of two separate iPhone and iPad apps.
And if you use a SplitViewController, you will have to add separate code for the iPhone. Same thing with UIPopovers.

Absolutely you have to redesign all UI corresponding to device screen size. You can create new xib or Storyboard separately for iPhone, So that you can achieve it.
You may use UIPopoverController in iPad but it won't work in iPhone, you have to present that viewcontroller in iPhone. From that you can manage that.,

its so simple you have to change the xib file and other code will be same
You can create xib from
New File -> user interface => view

Related

Convert iPad app using Storyboard into iPhone app

I have one view which was created for iPad, using a Storyboard.
Now, I want to convert it to an iPhone app.
I am very new to Storyboards. Until now, I have been using separate XIB files.
Can you please explain to me the steps for doing this?
What you want to do is important, if you want your app to just run on both iphone and ipad, you can go to project Summary and then in devices select "Universal" option. This will just run your app in both iphone and ipad(full screen and not 2x). But if you want to look it better then you have to manage your UI assets accordingly.

Objective C - One storyboard for iPad and iPhone

I just want to know if it is possible for an iPad and iPhone application to share the same storyboard?
I currently have 2 storyboards, one for iPad and one for iPhone. Is it possible to have both devices running form the same storyboard?
Regards,
EZFrag
If your iPhone and iPad has same views, then this is possible, the views you create in your iPhone will stretch to fill the iPad screen, however this is not recommended since iPad has bigger screen you should create different views with different view arrangements and structure for both the iPad and the iPhone
To set the same story board for the iPad and iPhone check the screen shot
Using the XCode6 Size Classes you can officially have the same Storyboard used for both the iPhone (all resolutions) and the iPad, saving you from keeping two files up to date.
The resulting storyboard is compatible with iOS7+.
Read more about this here: https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/AboutAdaptiveSizeDesign.html#//apple_ref/doc/uid/TP40014436-CH6-SW1
Use size classes to enable a storyboard or xib file to work with all available screen sizes. This enables the user interface of your app to work on any iOS device.

Converting an iPhone app to an iPad app in XCode 4

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

Is it possible to target both iphone & ipad using the same project?

The subject is self explanatory, I have a current iPhone project using Monotouch/MonoDevelop and I want to be able to target iPad too.
Is there any way that the application could do a "stretch"? I have not tested the app in an ipad, only in the emulator and it does not look good.
Thank,
Ignacio
Yes, you can. You can either programmatically check if app is running on ipad or on iphone and set different nib files for each mode.
Also you may use the same views either created programmatically or through Interface Builder, but in that case you should set your resizing masks properly.

Convert simple iPhone app to Universal app

I have very simple iPhone app, which uses just UIButtons, UIlabels, UITableView. without any custom controllers and graphics. How can I convert app to universal with that UI?
First update the application target device to Universal.
Update the application target device to Universal.
Check the Info.plist for NSMainNibFile & NSMainNibFile~ipad keys.
For all other views, have two different NIB. For example FirstView.xib & FirstView~ipad.xib. iOS runtime will load the proper view based on the device.
Here is a screenshot of a sample project:
I needed to convert my iPhone App to iPad yesterday and found the easiest way to do it as long as your app is pretty simple. Mine was literally just some tableViews that were set to auto-size. In Targets / Devices just change it from 'iPhone' to 'Universal' and then build your application. This worked very nicely for me. All tableViews were perfectly formatted for the iPad and that is really all I needed.
Note that if you had any other XIB files that were not just tableViews, such as a window with text fields, all you have to do is set them each to resize properly so they stretch and stay at the top and your simple app should be pretty much all set for the iPad.
Obviously you'll need to test it and tweak anything needed but for the most part the above worked magically for me and took literally one second to convert my iPhone app to an iPad app!