Convert iPad app using Storyboard into iPhone app - iphone

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.

Related

how to convert ipad version app to iphone version?

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

convert an ipad app to iphone app with custom views

This might be a repeat question.But i have a problem. I have an iPad app functional. The app is built in iOS 6. When i started building it i chose iPad as targeted device NOT universal. Now my client has asked for an iPhone version of it.In my iPad app i keep adding custom views as the client clicks "Add More".I add a custom view which is bunch of textfields, buttons etc.So i copied my iPad app and changed the Targeted device family to iPhone once and also Universal next time and tested it. So when i launch the app in iPhone configuration (keeping the targeted device family as Universal) my view controller stays like that on iPad. I cannot scroll the app also(not up/down..nor sideways). Is this the correct way to convert iPad app to iPhone app . Also everything is still with scale to iPad. Should i start a new project and start everything from scratch.Set the storyboard to fit according to iPhone configuration? In my research people said just change the targeted device family to Universal. But it doesn't work. Please let me know if you need more information. Thanks.
It is possible to convert the current project you have to an app that can be used universally, but it would take more time than simply just creating a new project that allows universal usage, and adding in the files of which you used for your iPad project.
Hint: You can use more than one storyboard when the project was created universally. It will automatically set this up for you.
I would also advise that you separate your files into what works universally, and what is specific for the iPhone or the iPad.
Happy Coding!
After many search i found that it possible to have an application for both Iphone and ipad devices.but in your code you should define unique ui for each device(two xib file).

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.

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

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!