iOS9 UIPopoverPresentationController UIModalPresentationPopover display at full width - ios

I have a UIViewController instance with a modalPresentationStyle of UIModalPresentationPopover. There are gutters in between the left and right of the popover that I want to remove so that the popover is essentially full-width.
What attributes can I adjust to remove the left and right gutter?

The width of a popover is governed by the preferredContentSize of its view controller. If you want total control over the size of a presented view, though, you should use a presented view controller and your own UIPresentationController subclass.

Another property to consider is the popoverLayoutMargins of the UIPopoverPresentationController.

Related

UIPresentationController present navigation controller view

On iOS 14, when presenting a modal navigation controller, non full screen, with UIPresentationController and modalPresentationStyle custom, the navigation bar take account into the safe area top inset (even if prefersStatusBarHidden is true). So, there is a gap equal to the status bar height at the top of the presented view.
Any ideas?
Fixed using the private API method _viewSafeAreaInsetsFromScene.

Embedding a UIViewController with dynamic height inside parent view controller

I am displaying a UIViewController(In NotificationContentExtension) with a child view controller. The parent controller is just adding to its view the view of child controller as subview.
The subview is all built with autolayout and constraints, which renders fine when not embedded in a view controller.
Currently, the parent notification is displayed as big as the parent view controller's view is configured to be in the extension's Info.plist file.
If I provide a height to the childcontroller's view in the parent view it renders as big as the parent but in case I don't initialise its frame, it doesn't render the child controller's view elements.
What I am seeking is to open the controller as big as the child view container's dynamic height make it to be.
To clarify, I believe what you're trying to achieve is a Modal "popup" View Controller than is smaller (in some way) than the View Controller that calls it, similar to the functionality of an Alert View Controller...
Go to your Storyboard and click on the child view controller with the custom height, then open the right pane to view the Size Inspector. I'm assuming here your Simulated Size = "Freeform" with your height and width. This will allow you to actually resize the View Controller in the Storyboard but the view controller will show up fullscreen.
Now click on the Attributes Inspector and in the 4th grouping down, check the box for Content Size "Use Preferred Explicit Size" and type in your simulated size. This will allow your Modal view controller to show up at the exact size you're asking.
To do this programmatically, try this in the calling ViewController's prepare for segue implementation:
destinationVC.preferredContentSize = CGSize(width: 300.0, height: 400.0)
Cheers :)

Is there anyway to change the position and size of UIPopoverPresentationController?

I want to use UIPopoverPresentationController. I have view controller which will be displayed in popover controller. However, I want to dismiss current popover and recreate and present again continuously.This implementation will cause the screen blinking. So If there is anyway to change the position and size of UIPopoverPresentationController ?

Change the size of pushed viewcontroller

I'm presenting a ViewController which has UINavigationController. Is it possible to change the size of whole NavigationViewController just like when showing UINavigationViewController in UIPopOver and the size can be handled with setContentSizeInPopOver. Right now I'm not using UIPopover but I want to change the size of pushed view controller. Setting the frame of UINavigationController of pushed controller in viewDidload isn't helping.
For changing the size of view controller that is to be presented u could use this one
How to present a modal view controller with custom size in center?
Not tested.
Try changing the frame of the view controller view's superview to desired frame just before presenting the navigation controller. Remove all the auto re-sizing masks of the view.

How to make the target view a subview of window using storyboard segue?

I am using storyboard and trying to segue from a bar view to a full screen view where the bar view's parent view is the same size as the bar view and is clipping subviews, but I'd like the destination view to take the full screen. Is there an easy way to do this by setting the properties of either the segue or the destination view controller? What is the proper way to do this? I really would like to make the full screen view a subview of window.
Thanks for any suggestions!
Luverio
I had to go around the segue by manually instantiate the target view controller and add it as the window's rootViewController.

Resources