need of two xibs for my portrait and landscape modes - iphone

i am very new to xcode. i have an app which supports both for iphone and ipad.presently my app supports portrait orientation, now i want to support it for landscape also.
As i goggled it and got an idea that we have to maintain two views for that.is this is the only way to do that? can't i maintain with singleview for landscape and portrait ?
if this is only the way provide me a good tutorial to do this because i have lots of views.
Note: my app should support in ios 4,5,6 also
thankyou

The answer is NO . You need not use 2 Xib's. Please go through the following links :-
Easiest way to support multiple orientations? How do I load a custom NIB when the application is in Landscape?
Different Xib's for Potrait and Landscape mode for iPad
http://www.theappcodeblog.com/2011/03/30/orientation-change-tutorial-change-the-view-when-the-orientation-changes/
Also ios 6 offers new methods like shouldAutoRotate etc. You might want to go through them too.

Related

Where are the methods that defines allowed orientations?

I've been working on my app for a while, and it've been out in appStore for a while as well, but I now want to add support for landscape orientation. I've thought I had just unchecked the orientation-icons in the Summary-page of the target to only enable portrait, but when I check them now, nothing happens! A lot of stash has been added, but I can't find any methods that should disable landscape.. What kind of method would that be? I didn't find anything in appDelegate either.. I don't even know where to start looking.. When opening an empty project in xcode, they orient just fine with no methods at all..
In storyboard, when clicking a view and going to inspector, it says Orientation:Inferred. So the problem isn't here.
I using a tabBar, and all the views in the viewControllers are set to Autoresize subviews, as a similar question got answered.
EDIT
When enabling landscape for iPhone using the buttons in the target properties summary, the iPhone is allowed to go landscape, but when enabling it for the iPad, nothing changes..
shouldAutorotate in iOS6 and shouldAutorotateToInterfaceOrientation for previous version.
Note that the orientation is mostly defined by the ViewController.
you can add or remove the supported orientations in info.plist
I solved the issue by making a class for the UITabBarController, and setting shouldAutorotate... to YES. I find it weird though that my iPad storyboard overrode the Summary-page.
EDIT
This is giving me a hard time with everything else.. The device rotates correctly now, but sometimes when launched in landscape, it thinks it's in portrait.. Still trying to figure that out. Even when I ask the app which orientation the devices statusbar is in, it returns portrait even if it really is in landscape..

what are the main different UIcontrols between ipad and iphone

I am new to iPhone and iPad development. I would like to work with the iPad. So I would like to know the main difference between iPad and iPhone UIControls.
Can anybody help me?
Thanks in advance.
There is ideally no difference between UIControls of iPhone and iPad
for iPad there is extra control named UIPopoverController and UISplitViewController
Also, for iPad, keyboard always have button to dismiss, which is at right bottom.
Hope this info helps you
EDIT :-
Here is implementation and demo of UIPopOverController
Please check MobileHIG for the controls.
The major difference is there is two controls for iPad, those are not available for iPhone.
UIPopoverController
UISplitViewController

Fitting controls on iPhone screen app when converting from iPad app

This might be a question specific to my app.I have an iPad app functional. I am converting it to iPhone app. So on one of my iPad screens i have 40-50 controls (labels, textfields,buttons,etc). Now can i achieve something like that on my iPhone also. Screen for iPhone is small and i can barely put 20 controls on one screen. Can i have a long vertical scroll view to put all my controls on one screen. I mean user can scroll down and down and have the same exact controls on this iPhone screen as on iPad screen but with different orientation. Or should i separate that one screen into multiple UIViewControllers? Please let me know if you need more information. Thanks.
Simple answer: You can do anything you want.
More elaborate: You could do a scroll view like you mention, but I'm sure this would be sub-optimal. You have a few options to deal with the difference in devices. The one you choose usually depends on the view or the amount of content it contains. You can 1) Simply resize it for the other device (this only works in rare situations where you have a simple view or one without much content). 2. You create a separate view controller for each and launch the appropriate one for the device (per apple docs). You could just slap your view in a scroll view, but depending on the specifics, a tab view, navigation controller, or some other option may provide a better user experience. In the end it's up to you...

iPhone - Portrait application but all orientation support for videos

Hey looking for some help on this problem.
Currently I'm developing an iPhone application which is locked to portrait orientation throughout, however there are some videos included in the app using the MPMoviePlayer.
I want these videos (which automatically show in fullscreen) to be supported for both portrait and landscape orientations.
Any detailed ideas on how I could go about this? Literally tearing my hair out.
Many thanks!
Remove the limitation from the plist.
In each of your view controllers, implement -shouldAutorotateToInterfaceOrientation: to return YES only for supported interface orientations. You must return YES for at least one orientation (the normal portrait orientation in your case). Examples abound if you are unclear on how to do this.
As #Till indicated, display your MPMoviePlayerController view using a view controller that supports all orientations in its -shouldAutorotateToInterfaceOrientation: (just return YES from the method).
But note that users tend to dislike apps that force an orientation, so make sure you have a very good usability case for why you need to impose this restriction. (The recommendation is you support all orientations except upside down on iPhone, so that the user doesn't try to, say, answer a call upside down.)
Display the MPMoviePlayerController on the view of a modally presented UIViewController that allows all possible interface orientations. That way the rest of your app may remain as is (portrait only).

How to make a universal app

I have a iPhone app I want to convert to an universal app so it can run on iPad. I have tried to find information about how to do it, but I don't find anything that answers my question. I have upgraded the iphone target in xcode to ipad. Then I get a new MainWindow-iPad.xib.
But I have many viewcontrollers and I have made those with code, not xib's. Do I need to have a if-clause in the loadView method that loads different viewcontroller depending on if the user has a iPhone or iPad?
It kind of depends on how you've implemented your loadView methods and how you want your iPad version to differ from your iPhone app.
If you just want your app to use the full screen, you can mostly just check the size of the screen and size your views appropriately and use the autoresizing mask to deal with things when you change orientations.
There are a few gotcha's with this approach, though. For example, modal views can work differently (not taking up the whole screen) and, obviously, the keyboard is a different size.
If you want to use completely different views for your iPad app then, yes, you'll quite possibly have if statements that tell it to use completely different view controllers.
Yes you have to create all xib's for iPad and then you have to write if-clause for Ipad xib to be loaded.