IOS development how to solve window design problems

Lei feng’s network (search for “Lei feng’s network” public attention): this article by nuggets translation translate translator llp0574 Douglas Hill of the Preventing Popovers on Popovers, proofreader: yifili09, Graning. This started re the nuggets without permission prohibited reprint.

IOS 9 pages displayed in a way that we can’t reproduce an activity view controllers, and when the internal form, and pop-up action list and active UIKit view controller a started to look less coherent. We presented two Radars to Apple: Can’t show activity view controller filling a form sheet and Reading an alert controller’s popoverPresentationController property changes behavior.

IOS interaction guidelines state:

Do not display in a window of a modal view. Due to a warning window may be an exception, so it should not show anything on it. Very few cases when you really need to show after an action leading to pop a modal view, should first turn off popups to display.


Only popup once. Show more popups will make interaction suddenly becomes cluttered and confused. Don’t show a cascade or a hierarchy of popup, one from another. If you need to show a new window, close has been ejected first.

In the horizontal levels of normal environment and compact environment with full screen popup view controller styles should be rendered as popups. Style UIActivityViewController and UIAlertController the actions list to follow the same rules: displayed as popups or pull on a table. So if a popup showing an active view controller or a list exactly what’s going to happen? This interactive guide to the document’s argument seems to be a contradiction.

IOS 9 a description of the page, we note a view controller shows a form fill out this form UIActivityViewController, want to know that this is not a problem we have not noticed before the default behavior? Or it is not a thing we can customize to achieve?

For most view controller, display inside a popup or form needed to set current view controller modalPresentationStyle for the currentContext or overCurrentContext. But for some the view provided by UIKit controller such as UIActivityViewController and UIAlertController, which have been given their own style, modalPresentationStyle changes will be ignored.

In General, show popup UIActivityViewController in regular width, compact in width, into a transparent table. But if a regular-width view controller to controller from the width of a compact view shows what would happen? This will be a form or popup view controller modalPresentationStyle to display on the iPad, or is it a custom display controller that uses the overrideTraitCollection property, and then the controller shows a UIActivityViewController.

Action list

First of all, we take a look at UIAlertController. Diagram view controller (blue) with pop styles (below, by splitting the view for reference) showing the second form style (top) view controller (Pink). And then shows a second view controller operation warning controller list style.

Although we want to use the list of display styles to display list of actions (not pop), but because of the advantage of separation of concerns, I warn controllers popoverPresentationController.sourceView and popoverPresentationController.sourceRect are set, view controllers show how it should not make assumptions. It should be carried out in other parts of the app full screen display, view controller should not have control over these actions.

Out of curiosity, I tried to comment out the definition of popoverPresentationController, to my surprise conditions occur:

Read-only warning controller popoverPresentationController width property can result even from a compact environment it will be displayed as a pop-up. If you want to do this, please be sure to view controllers show environment, because if you want to show from the General environment of the width of a pop-up warning controller source is not set, UIKit will throw an exception. Remember in the show is triggered when rendering the view controller in a compact width environment, when the display is activated when it is likely to change.

I submitted a rdar:Reading an alert controller’s popoverPresentationController property changes behavior. iPhone 5 cases Ted Baker Ted Baker iPhone 5 Case

Active view controllers

Do the same thing with UIActivityViewController and specify the popup source information appears below:

Different from the behavior of the page, I found the controller shows the active view of the form as a popup, popups on the controller are on display in the active view of the form. This is a new behavior in iOS 10, iOS 9, is from another window shows a pop-up window.

Used the same techniques to access popoverPresentationController not lead UIKit throws an exception saying “must provide location information for this window”.


We found the view when the UIKit controller from a display on the General environment compact width the width of display behavior in the environment will become very confusing. Popups show general rules under the General width of display window, in compact width to full screen (although the current environment makes more sense). List of actions and activities view controller display is a bit like popups display, but do not fully follow the General rules for display.

Actual behavior may appear to be the same as interactive guide said, and largely ignoring the characteristic Size of the collection class. UIKit will not display in the action list exception warning popups. Size class does not control everything.

We cannot reproduce pages (Pages). For us, when a form showing an active view controller, it will display the pop-up. I reported the problem to Apple (Radar:Can’t show activity view controller filling a form sheet).

Like this:

Like Loading…


Originally published at on August 5, 2016.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.