Ipad orientation problem when a splitview is brought in - ipad

I have an application in which my first view has a label and a button..when I click the button, I bring in a split view.
The problem I am facing is that, the orientation of the split view is acting wierd. At times, it displays in landscape orientation properly and at other times, it displays in portrait orientation with half of its view cut. During this time, when I change the ipad orientations using the cmd + arrow keys, the split view goes haphazard.
I have included in my info.plist file -> Information property list " Initial interface orientation" and its value " landscape (right home button)". Other than that, I have not made any change...
The main thing which is bugging me is that, this does not happen all the time. It happens off and on.
It would be great if someone could help me out in this.

If you check the docs, I think it says that the split view should be the root view of the application. Not complying with this will likely cause 'buggy' behaviour.

If Jack is right, you should let the split view be the root view and just display your first view above it. When the button is tapped you dismiss the first view and the root view/split view will be visible.

Related

Issue when using multiple UIWindows that don't all support landscape mode

I have a very simple test iOS8 application that uses two UIWindows. The first window is only allowed to be displayed in portrait mode. When shown, the second window allows AllButUpsideDown.
The button in the first window can be used to show the second window...
The second window supports landscape mode as shown below...
If the second window is dismissed (removed) while in landscape, the first window now looks
like below..
Why is the status bar in left in the landscape position? Also, I noticed the [UIScreen mainScreen].bounds are landscape size?
(Setting the status bar orientation does nothing)
Any help would be greatly appreciated, thanks.
I found the solution and thought I'd share..
To force the orientation to change you have to 'present' a view controller that has its preferredInterfaceOrientationForPresentation method set to the orientation you want. So, in the above case the main window's root view controller can present/dismiss a blank view controller with its preferred orientation set to portrait.
When you click on the right part of the "window 2", what happen ? If you look at the point clicked, do you have the right coordinates ?

View Controller in the "More" tab doesn't rotate, but it will if it's on the home row.

I have an app built in storyboard that needs to support landscape mode in just one view controller. I decided to support iOS 6 after some issues with supporting iOS 5 and running iOS 6 on my phone. I used this Stack Overflow answer: https://stackoverflow.com/a/12505461/1050388 but I'm still seeing a weird quirk. (For those interested, my controller scheme is Tab Controller -> Navigation Controller -> TableViewController -> UIWebView. The UIWebView is the only VC I need to rotate.)
I blocked all but one VC from turning, but that VC is in the "More" tab. I initially had a quirk where this "More" VC would change orientation to landscape when rotated and then any subsequent VC would be in landscape, but I found this (https://stackoverflow.com/a/12526152/1050388) and creating a category for UINavigationController helped to solve that issue.
However, when I navigate to that tab in the "More" list, and turn the VC, it doesn't rotate. But when I click "Edit" and move that tab to the home row of the initial 4 tabs, it rotates just fine. If I move it back, it doesn't rotate. Anyone have an idea why this is happening?
I believe the problem stems from the fact that the More navigation controller is generated dynamically by iOS and is read-only.
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITabBarController_Class/Reference/Reference.html#//apple_ref/occ/instp/UITabBarController/moreNavigationController
It would be great if the technique of using a custom category would work here but based on your experience I guess it doesn't.
I also need better control of orientations for More tab views. Please post anything you come up with. Thanks.

iOS 5 Storyboard Orientation does not work

We have an app we are designing using iOS 5 storyboards (Xcode 4.4, Mountain Lion) with a tab view controller and we're trying to add a split view controller as a third tab.
Prior to adding the Split View Controller, we set all the view controllers to landscape orientation in the simulated metrics section of the storyboard editor. Worked fine. Added the Split View Controller, changed its orientation to landscape, and the first tab (not the split view) now draws all the UI elements as if it's portrait when we run it in the simulator. The simulator defaults to landscape, but the UI is sideways as if it was portrait, with most of it hidden (because it's designed to be landscape).
We deleted the Split View Controller and the problem persists.
Any ideas? We've cleaned, re-built, quit Xcode, re-run, etc. There has not been one stitch of code added yet, as we are simply trying to build the UI appearance before writing code to back it up, and we're at the very early stages.
Thanks.
Andrew
See my answer here for the steps to make sure you have a landscape oriented app all around.
When I click the back button my view changes from landscape to portrait
Also Split View Controllers have to be the rootViewController. Adding them as a tab inside a TabViewController won't work out of the box.

Show a translucent/transparent modal view with support for device rotation

I want to show a translucent/transparent modal view that should cover the entire screen except status bar. Also, I shall be having different layouts for portrait and landscape orientation (in that modal view). I have done thorough googling and found some solutions. Below, i am summarizing them as well with their problems:
Add a view directly to the window: This works nice, but the problem
is device rotation. If I go by whatever I have experimented/learnt
so far, the UIWindow bounds do not change on rotating
the device. This poses a problem - I can't have my landscape modal
view unless until I do some sort of transformation on my view -
something which I am reluctant to. I am also not sure, whether it
will work, as I may have a webview of 1/3rd of the screen height and
full device width in portrait (rest area is translucent), and 1/4th of the screen width, full device
height (minus status bar) in landscape. I read that window changes the bounds (size and coordinate space orientation as well) of Root View controller's view bounds - can't I ask it to change the bounds of my modal view as well? After all Root controller view is also added to the window as a subview only.
Adding the modal view to the root controller
view: This is working fine for me so far with my custom root
controller based app. The problem is, I have to write my code as a
generic module, so that it can be used with different types of
applications. So, if the application root controller is one of the
out of the box container root controller ( like
UINavigationController, UITableViewController, etc ), then, is it
allowed to add a subview directly to their view ? i.e. is is not against the
Apple guidelines? While reading documentation, I read somewhere that
we should not play with standard UI controls, like Buttons.
While reading documentation, I also read it somewhere that UIAlertViews are
shown using another Window. How do we do that? is it normal to add
another window to the app? If things are as per the Apple
guidelines, I can try this approach - I shall make my modal view
the root view of another window and display that window.
What I am trying to achieve is very similar to showing UIAlertView, only in my case, I want my view to be fully customizable.
Thanks,

UISplitView having issues in Portrait

I have a UISplit-view that uses Table-views in the left hand "Master" area and it seems that after pushing several table-views on the Root Controller, followed by popping them off and all the meanwhile, rotating back and forth between portrait and Landscape, the button in portrait seemed to stop responding.
Upon further investigation, it turned out that it wasn't that it wasn't not-responding, it was that the area that was touch sensitive was sliding partially off the screen making the area that you could touch to get the "Master" popover was at the very Edge of the button making it extremely difficult to hit. I do have a flex space, title, and additional logout button.
Any Ideas?
It turns out that in the Mono-touch split-view template, has two methods in the Detail Controller, in one it hides the popover and button for the Master view while in Landscape, and in the other method it puts it back. I was using one of those methods to add a fexible space item, text item, and logout button to the toolbar. The problem was that because I was doing it in that method, it was adding them every time it went to portrait and somehow the flexible space getting added every time, was slowly pushing the touchable area for the Master Button, off the screen. (The Button itself never moved) After adding the items to the toolbar during the ViewDidLoad method, and not adding it again, resolved the issue.

Resources