Presenting transparent modal UIViewController on iPad iOS 7 - ios

I have an iPad app which supports all orientations and has a UITabBarController managing a set of view controllers. Rotation works as expected everywhere. Keep in mind my UITabBarController is the .rootViewController of my app's UIWindow.
I now go to present a UIViewController modally from my UITabBarController. It presents well, and the status bar moves in accordance with the device's orientation. However, my UIViewController's view frame never changes (it is always in portrait dimensions, regardless of how it was presented).
This isn't an issue on iOS 8, and I thought UITabBarController would handle a modal controller on its own. Is there something I'm missing?
Bonus: ultimately this UIViewController will be transparent and reveal the app beneath it. When I try this and rotate my device, none of the regular view controllers rotate.

However, my UIViewController's view frame never changes (it is always in portrait dimensions, regardless of how it was presented).
This is expected. In iOS 7, rotation was implemented by applying a transform to the top-level view controller's view. The application of this transform does not alter the frame, which remains in portrait dimensions. In iOS 8, rotation is implemented at the window level.
Bonus: ultimately this UIViewController will be transparent and reveal the app beneath it. When I try this and rotate my device, none of the regular view controllers rotate.
The UIModalPresentationStyleFullscreen presentation style removes the presenter's view from the window while it is covered by the presented view controller. If you modify the alpha of the presented view controller's view, you'll just see black underneath.
Since UIModalPresentationStyleOverFullscreen did not exist in iOS 7, you would need to use UIModalPresentationStyleCustom with your own transition animator. Unfortunately, custom transitions with view controllers that can rotate is extremely buggy in iOS 7.

Related

Rotating a VC presented as UIModalPresentationOverCurrentContext

iOS 8. I am presenting a view controller with presentation style: UIModalPresentationOverCurrentContext. This works great until I rotate my device, at which time the presented view is not properly adjusted.
Example: I presented over a portrait context. Entire screen covered by my new view (which has semi-transparencies). I rotate to landscape. The presented view rotates, but is now centered and remains at portrait width.
Both the presenting VC and the presented view are created in a storyboard using autolayout. Since I can't add constraints to the topmost view in a VC (right?) I'm not sure how to keep my presented view entirely covering the view below it.
This can happen if Presentation in the Segue is set to Page Sheet. In the storyboard, change the presentation to Full Screen or Over Full Screen
Since you're not using a segue, use UIModalPresentationOverFullScreen.

iPad application, changing popover dimensions whilst view is loaded

I have an app in which its my intention to change screen orientation as the user rotates the iPad. In my app I have several popovers.
The potential issue I'm concerned about is one of my popovers covers most the screen so if rotation changes, I'd want the popover to change view dimensions. Is it possible whilst a view is open or will i have to close it and reopen it.
Thanks
If your using a UIPopoverController the standard behaviour it does is to hide the popover when you rotate. It try's to then reposition it for you, this tends not to work so you want to use popoverController:willRepositionPopoverToRect:inView to set your new position and resize as needed.
If you use setPopoverContentSize:animated: it will re size for you, If your using autolayout you'll want to use preferredContentSize in the content viewController.
Apple Doc:
If the user rotates the device while a popover is visible, the popover
controller hides the popover and then shows it again at the end of the
rotation. The popover controller attempts to position the popover
appropriately for you but you can also implement the
popoverController:willRepositionPopoverToRect:inView: method in the
popover delegate to specify a new position.

iPad detail settings page like popup viewController

The first thing i would like to clarify is that i'm not talking about the splitview controller. I want a pop up with a navigation controller similar to the one you get when you tap the Keyboard>>Languages or Mail>>New Account.
Now this is not a popover controller, any standard framework available for this? Maybe i'm missing the obvious. The good things about this is that it has navigation controller and hence the view resizes to fit subsequent tableview lengths.
This is not a popover. It's a modalView with presentation style UIModalPresentationFormSheet
Check this link
For more presentation styles refer ModalPresentationStyle
Presentation Styles
Presentation styles available when presenting view controllers.
typedef enum {
UIModalPresentationFullScreen = 0,
UIModalPresentationPageSheet,
UIModalPresentationFormSheet,
UIModalPresentationCurrentContext
} UIModalPresentationStyle;
Constants
UIModalPresentationFullScreen
The presented view covers the screen, taking into account the value of the wantsFullScreenLayout property.
Available in iOS 3.2 and later.
Declared in UIViewController.h.
UIModalPresentationPageSheet
The height of the presented view is set to the height of the screen and the view’s width is set to the width of the screen in a
portrait orientation. Any uncovered areas are dimmed to prevent the
user from interacting with them. (In portrait orientations, this
option is essentially the same as UIModalPresentationFullScreen.)
Available in iOS 3.2 and later.
Declared in UIViewController.h.
UIModalPresentationFormSheet
The width and height of the presented view are smaller than those of the screen and the view is centered onscreen. If the device is in a
landscape orientation and the keyboard is visible, the position of the
view is adjusted upward so the view remains visible. All uncovered
areas are dimmed to prevent the user from interacting with them.
Available in iOS 3.2 and later.
Declared in UIViewController.h.
UIModalPresentationCurrentContext
The view is presented using the same style as its parent view controller.
When presenting a view controller in a popover, this presentation style is supported only if the transition style is
>
UIModalTransitionStyleCoverVertical.
Attempting to use a different
transition style triggers an exception. However, you may use other
transition styles (except the partial curl transition) if the parent
view controller is not in a popover.
Available in iOS 3.2 and later.
Declared in UIViewController.h.

iPad - General Network->What is the UI control?

In the below image, what is the UI control used to create the "Other Network" dialog? We need to create a similar non-full-screen popup.
I think what you're looking for is a UIModalPresentationFormSheet.
From Apple's UIViewController documentation reference
UIModalPresentationFormSheet
The width and height of the presented view are smaller than those of the screen and the view is centered on the screen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so that the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.
Available in iOS 3.2 and later.
Declared in UIViewController.h.
See this article for an example Display a view using modalPresentationStyle
It should be a view controller presented modally using UIModalPresentationFormSheet as its modalPresentationStyle.

iPad Modal View Dismissal Changes Parent View Orientation

I have an iPad Split View Application that brings up a modal view to display certain content. When I bring up the modal (in PageSheet style) and then change from Portrait to Landscape (or vice-versa) and then dismiss the modal the orientation of the detailViewController (the parent of the modal) turns 90 degrees.
So if I am in landscape mode when I close the modal the right pane will turn as if it were in portrait mode but the device is still in Landscape and the rootViewController is still visible. After this happens no rotation will solve the problem until the view is removed.
Any idea what I've screwed up here? I've had a ton of trouble with iPad rotation handling in general but this one is really giving me problems.
If you are presenting the modal view from either of the two sub-views of the SplitViewController, then you will have the orientation problems. Just present the modal view from the SplitViewController.

Resources