Need suggestions to implement Orientation methods in iOS app - iphone

I have implemented one universal iOS app for both iPad & iPhone that supports iOS6 & iOS7 in Portrait mode.
Now my new task is to support landscape mode for this app also.
These views are not Auto Layout enabled.
My question is, Is there any great solution for orientation instead of implementing all orientation methods and writing code in each UIViewController class?
I have used too many controls in each XIB file.
Please make suggestions to me.

Autolayout is probably your best option. If you haven't been exposed to autolayout before I suggest reading a tutorial on RayWenderlich.com and watching the autolayout videos from the past 2 or three WWDC's. Several of the 'beginning autolayout' videos address the problem your facing.

Related

Create Apple TV Apps in portrait orientation mode

For my business purpose we have to place Apple TV in portrait mode. How can I create an app that have portrait orientation?.
The concept from an SDK perspective does not exist. None of the rotation-related methods from iOS made it over to tvOS, and for a good reason. With that said, there is still a small segment where it could be useful to have your tvOS application being rendered with more vertical than horizontal space.
You can read this post for some help.

Storyboard orientation

I'm creating one iOS app and I'm using Storyboards to create the UIs. App should support iOS5 and above devices
In MainStoryboard_iPhone and MainStoryboard_iPad I have the UIs designed for the portrait mode.
Now I need to design them to work in landscape mode as well.
What is the best way to do that? Do I need to create another storyboard for landscape mode or is there a easier way?
For each UI I have set a background image using Imageview. Is there a image naming convention, when I used for e.g like myimage-Landscape.png it automatically detects the landscape mode image and sets it?
You could go ahead and create a separate storyboard.
However the actual recommended Apple Guidelines would state that this is what Constraints are designed for.
I learnt from this fantastic tutorial:
http://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-2

Adjust iPhone 5 Screen Size Without Using Autolayout

Enabling Autolayout in .xib or .storyboard and adding a splash screen of 640px by 1136px enables iPhone 5 resolution support for the taller screen.
However, doing so, my app started to display some funny things where I assume autolayout is not a great idea.
I am wondering if there is a way to enable iPhone 5 device support, i.e. fix app's resolution without using Autolayout? Maybe I can set in the code?
If yes, then I will have no need to create 2 storyboards or nibs to support iOS5- and iOS6.
If you weren't using Autolayout before, you won't need to use it for iPhone 5 support.
When you're putting your interface together, you just need to check your bindings, and toggle between the taller phone size, and the regular phone size, as described here:
Xcode Storyboard displaying the new iPhone 5 screen size?
If your screens look fine in both screen sizes then you're done.
If you are doing a lot of coding to show your UI, then you'll have more work to do.
I found a great answer a couple weeks ago (link below). You will copy and paste your older iPhone Storyboard, rename it to reflect the iPhone 5, and press the button that expands the screen size, found on the bottom of the layout grid. Some minor coding adjustments might be needed, but this sample code is used in the AppDelegate to detect which device is running, and hence, which Storyboard to use. You'll just have to duplicate your interfaces, but these GUI changes can be made without code and without AutoLayout (also good to note that AutoLayout removes iOS 5--and lower--compatibility)
xcode 4.5 how to pick storyboards at launch

What is the best way for supporting both screen resolution of iPhone4 and iPhone5 ? - Auto layout in only iOS6

Have anyone figured out how to support both screen resolution iPhone4 and iPhone 5 ?
In iOS6 we have support of Autolayout. Can that be used for iPhone4-iPhone5 screen i.e. 320x480 and 320x568.
If we use auto layout feature for that we will have to keep deployment target minimum to iOS6. What about iOS5 than ?
What about iOS5 than ? Do we have to handle it programatically for different screen size ?
I searched web and could not find exact answer for that so posting this question though having doubt of having downvotes. Please bear with me for that. I guess this question is very basic to support new device in applications and is applicable to all developers.
If you want to support iOS 4.3 or 5 then turn off the Autolayout.Then you have to set the UIViewAutoresizing correctly either in code or interface builder.
With the autoresizingMask on UIView you can make the view stick to aside and grow with the size of the superview.
One other approach can be to design separate views for iPhone 5 and iPhone 4S.
Check screensize and load views accordingly, as in the case of universal apps.

Is it the same write the iPhone and iPad app?

I have a question about the objective C. I am writing the iPhone application and I want to app which can also run on iPad. Is there are some change do I need to do? As I set the element in code rather than using the Interface builder. Do I need to reset the x,y,width and height for the application? Thank you very much.
You can run exactly the same app developed for iPhone on the iPad. However, it will not use the full screen of the iPad. Look at the Facebook app for instance, you can zoom it but it doesn't look very nice. If your goal is to run an iPhone app on the iPad, you don't have to bother much. If you want to really support iPad in your application you should implement a separate UI for iPad and this is supported in XCode. The iPad has of course a larger screen but also some additional layouts and controls that make apps look great on the iPad.
Have a look at http://developer.apple.com they have more information about this.