I know Xamarin supports universal iPhone/iPad views; however, after building some iPhone specific screens, it was mentioned about iPad support. In Xamarin Studio, is it easy to add an iPad view attached to the same controller after the fact? I know it uses an idiom to do the switch, as shown below (taken from here):
public Hello_UniversalViewController ()
: base (UserInterfaceIdiomIsPhone ? "Hello_UniversalViewController_iPhone" : "Hello_UniversalViewController_iPad", null)
{
}
Within XCode, how can I then link all the same outlets and actions easily? It seems possible, but looking for any guidance. Or should I just delete them, then re-add them with the universal view?
Thanks for any help...
No you should not delete your iPhone storyboard file instead you make one from file->Storyboard file and select for iPad. You can copy paste controllers from iPhone storyboard but then you have to set the dimensions and other relevant info specific for iPad.
hope this helps :)
Related
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
I recently developed an Application on iPhone in Xcode version 4.1.
Now I need to convert this app for iPad also.
I have verified so many links but all are regardig Xcode 3 ond it's extensions.
How to upgrade, how to resize the view etc etc Please help me. Thanks in advance
Okay, first open your project and click on the project icon, then select the icon below Targets. Select Summary from the right hand side, and change the Devices from iPhone to Universal (under the iOS Application Target). Now your app is ready for iPad. Now to modify the views, if you are not using XIB files, go to your view controllers viewDidLoad / loadView method and write the following code:
if(UI_USER_INTERFACE_IDIOM())
{
// re-size your views here
}
And if you are using XIB files, go to your viewcontrollers XIB file, select the view(i.e view window, label, buttons etc.) and select Show Size Inspector from Utilities.
Now you can see Autosizing panel just under the origins and height-width menu. Select the arrows inside box to set autoResizeMask to get the desired size in iPad and then select the arrows outside the box to set the position in iPad.
And that's it, hope this helps you :) Cheers!
Thanks everyone for helping me out. It turns out that this tutorial explained what I needed.
http://www.youtube.com/watch?v=RY-btZ-KjX0
It might be helpful for others.
I was recently developed a big project on iPhone in Xcode version 4.1.
Now i need to convert this app for iPad.
I have verified so many links but all are regardig Xcode 3 ond it's extensions.
How to upgrade, how to resize the view etc etc
Please help me. Thanks in advance
Your best bet would be to create two new projects, one for iPhone, and the other universal and see what differences are in place there, especially the app delegates.
Quite a lot of the things won't be needed, however the app initialisation need some consideration, and most views tend to happily scale up to ipad resolutions without much or any additional work.
That was how I added iPad support into one of my apps I was writing anyway.
Depends how your app is build. If you are using Builder in XCode you can simply create new xib for each controller/view you have in app and name it with suffix ~ipad.
So if you for example have MyController.xib you will create MyController~ipad.xib and your controller will be loaded from this file automatically when run on iPad.
Changing the project preferences to universal gives you the possibility to specify a second MainWindow.xib in the info.plist file (Main Nib file base name (iPad)) which is the starting point for your iPad Interface. At this point running the app on an iphone would load your original interface and running on an iPad gives you the blank window once you created the corresponding blank MainWindow file.
Edit: You need also a second AppDelegate that holds the reference to your new window.
I've been following an excellent guide on how to create basic custom table cells and populate them via a plist. The problem i've run into is the guide is written for iPhone, and i'm developing an app on iPad, one of the key issues is when creating the project, the guide uses a Navigation based template for iPhone, where iPad isn't selectable. Later on the guide it says to add outputs to this controller.
I tried following the guide using a Window based template for iPad, but have run into some problems when connecting the output. In particular where I add my 'customTableViewCell' outlet to the 'RootViewController' (which is a UITableController) - in my iPad project, it's just a 'UIViewController'
Is there an easy was to solve this? or is developing it on iPad a totally different tutorial?
thanks.
On the iPad, the Split-View format is really for navigation. It has a root view controller that is a tableview. You might have good luck starting with that template.
In the Interface Builder, you can add UITableView by dragging it onto the view.
Just a silly question that just cant figure out. Ive been working on iPad apps for a while but now Im back on an iphone project.
I created an iphone 4.0 sdk based project but when i double tap on a xib file, IB comes with iPad layout and i cant figure out how to switch it back to iphone layout.
Anyone?
When you create the project, be sure to select Product = iPhone in the "New Project" window.
Also, if you already have the iPad views, you can transform them to iPod/iPhone views through File->Create iPod/iPhone Version using autosizing masks
Partially solved,solution sucks. i created a view based project and there IB shows xib with iphone layout. Couldnt find a solution yet when creating a window based project.