Landscape and Portrait Orientations for iPad Apps - iphone

I know this question has been asked for many times. I've searched but didn't get the proper answer which one will be able to implement nicely.
Question : How can I handle the Landscape and Portrait Orientations for iPad Apps ?
Note : In interface builder's Size Inspector -> Autosizing we can set the orientations for Images but when we have a complex view how can I change the orientation from Portrait to Landscape nicely ? If we need to call different .xib , how to do that ?
Thanks

You can use the UIViewController reference document
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
These contain methods like didRotate, willRotate etc and u can override them according to your needs. When the rotation of the view occurs u can adjust the view's size through the auto-sizing options. You can know more about auto-resizing options in UIView reference document
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html
Pls go through the UIViewAutoresizing part.

Related

Hide DetaiViewController in UISplitViewController in portrait orientation

i want know if it's possibile to hide the DetailViewController in portrait orientation for the UISplitController template ipad example, and let use the MasterViewController in full screen in portrait orientation, and when the orientation change to landascape use the normal UISplitViewController view, with masterview on the left and detail view on the right...it's possible?
Apple's UISplitViewController has been given a very specific behavior, and cannot be customized this way...
In my company, we had to implement our own SplitViewController - our intent was to handle different display of 'masterViewController' when in portrait orientation, different sizes for both controllers in landscape orientation (than those allowed by UISplitViewController), and a different way to handle 'masterViewController' display in portrait orientation -
This heavy customization led us to deal with all kinds of problems regarding UIViewController containing others UIViewControllers - (UIViewControllers containement wasn't supported by Apple before iOS 5 ! see CoconutKit on Github, or this example for workaround examples...).
For your specific needs, here's Matt Gemmell's own attempt at implementing custom SplitViewController , it's quite good, you can still fork the code to make it fit your own needs.

Changing parameters on iOS device orientation

I have a Tabbar project in which one one the tabs should be on landscape mode. I've seen than the Tabbar controller only allows it only if all its views allow it. Son now I'm somehow forced to adapt all the views for both portrait and landscape mode, which I've never did before.
Am I right assuming that all should be done under:
-(void)willAnimateRotationToInterfaceOrientation...
so what happens with subview which are lazyly initialized? such as a footerView on a tableView?
Another thing is, I have a method to scroll the tableView so nothing is kept under the keyboard when it's called. The method uses a constant float + a variable. In landscape mode, the constant should be another.
Any feedback would be appreciated. Thanks in advance!
Read up on autoresizingmask - setting this attribute on your views will automate a lot of the orientation resizing.
And yes, you'll need a landscape and a portrait value for your constant.

UIView loaded from segment managing view is not resizing in landscape mode

SegmentManagingView
I am trying to do something like above link. I set the Rotation code in my segmentmanagingview
But it is not resizing in landscape mode.Table's width is 320 px in landscape and portrait mode.Any other way to achieve this?
First read Apple's Why won't my UIViewController rotate with the device or the many links on SO to see if rotation is being allowed. Most of the time this will fix it. Other approaches are:
Implement didRotateFromInterfaceOrientation and implement a relocation (setting new centers for each view).
Duplicate the view and swap the subviews (iterating the subviews and replacing one with the other).
Switch views (create a landscape and portrait view on the same nib and change the active view).
There are examples for all three techniques on the iPhone Developer's Cookbook from Erica Sadun. The source code is free to download, look for chapters 2-3.

iPhone Orientation Change

I know how to do an orientation change, but lets say you have a view with buttons, labels, ect. The autoresizing distorts and makes the view look strange. What's the accepted way to do this, do I just create a portrait and landscape view. If so where would I actually do the swapping of these views.
Do all kind of resizing and reposition in your layoutSubviews method of UIView.
Once the orientation is changed, your layoutSubviews would be called then you can know the current orientation by using UIDevice class. and reposition your views child accordingly
UIDevice property to be used for getting current orientation .
#propertyic,readonly) UIDeviceOrientation orientation
My sandbox app:
https://github.com/comonitos/programatical_device_orientation
The solution is easy

Iphone sdk custom uiview orientation issue

I am using custom based uiview controller with uitabbar contains uitableview. I am using image for cell background. I want to do orientation from portrait to landscape but the issue is it is not changing on orientation. I just want to know is there are any special thing for custom uiviewcontroller for orientation?
Thanks in advance
Regards,
sathish
If nothing happens when you rotate the device, you either have the system-wide rotation lock enabled (you checked that, right?), or your view controller isn't returning YES to the alternate orientation in its shouldAutorotateToInterfaceOrientation:, or you're doing something odd with your views that means your view controller isn't getting set as the “frontmost” one and thus isn't getting asked about orientation changes. It'll be easier to narrow that down if you post the code you're using to set up the controller and its view.