iOS development, how to solve the pop-up window design problem?

Lei Fengnet (search "Lei Feng Net" public concern) by: This article by the Nuggets translation plan translator llp0574 translated from Douglas Hill "Preventing Popovers on Popovers", proofreaders: yifili09, Graning. In this paper, the first rare earth nuggets, without permission, is prohibited from reprinting.

The iOS 9 page uses an approach that we can't reproduce to present an active view controller, and the behavior of UIKit does not seem to be coherent at first when the action list and the active view controller are rendered from internal forms and popups. We submitted 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 man-machine interaction guide statement:

Do not show a modal view on a popup window . Since a warning pop window may be an anomaly, nothing should be displayed on it. In rare cases, when you really need to show a modal view after an action causes pop-ups, you should close the pop-up window and display it.

and

Only one pop window is displayed at a time. Displaying multiple pop-ups can make the interaction clutter and confused. Never show a cascading or hierarchical pop-up, one created from another. If you need to show a new popup window, first close the one that has already popped up.

View controllers with pop-up styles in landscape-level general environments and full-screen compact environments should appear as pop-up windows. UIActivityViewController and UIAlertController, which have an operation list style, follow the same rules: they are pop-up windows or a pull-up table. So what happens if a popup shows an active view controller or an operation list? This man-machine interaction guide document seems to be somewhat contradictory.

In a related note on the iOS 9 page, we noticed that the view controller of a form displayed a UIActivityViewController populated with this form. Would you like to know if this is a default behavior that we didn't notice before? Or is it something that we can customize to achieve?

For most view controllers, displaying a popup window or form in the interior needs to set the modalPresentationStyle of the current view controller to currentContext or overCurrentContext. But for some UIKit-supplied view controllers like UIActivityViewController and UIAlertController, they have been given their own style, and the modalPresentationStyle changes will be ignored.

In general, UIActivityViewController will be displayed as a popup window at regular width and a transparent table at a compact width. But what if a regular-width view controller wants to display from a compact-width view controller? This situation will be displayed on the iPad in a view controller with a modalPresentationStyle that has a table or popup, or it is a custom presentation controller that uses the overrideTraitCollection property, and the controller then displays a UIActivityViewController.

Action list

Let's first take a look at UIAlertController. The root view controller (cyan) in the figure shows the second view controller (pink) using the popup style (bottom, by splitting the view behavior for reference). The second view controller then shows an action list style warning controller.

Although we want to use the display style of the list to display the list of operations (instead of pop-up windows), because of the advantage of separation of concerns, I set the popoverPresentationController.sourceView and popoverPresentationController.sourceRect of the alert controller, and the view controller should not How to show assumptions. It should be displayed in full screen in other parts of the app. The view controller should not control these actions.

Out of curiosity, I tried to comment out the definition of the popoverPresentationController and something unexpected happened to me:

Originally only reading the popoverPresentationController attribute of the warning controller would cause it to appear as a popup window even if rendered from a compact-width environment. If you want to do this, be sure to make sure that the view controller shows the context before and after, because if you want to show a warning controller that doesn't have popup source code from a regular-width environment, UIKit will throw an exception. Keep in mind that even if the presentation view controller is in a compact-width environment when the trigger is presented, it may still change when the presentation is activated.

I submitted a rdar: Reading an alert controller's popoverPresentationController property changes behavior.

Active View Controller

Do the same thing with UIActivityViewController, and specify popup source information, the following situation occurs:

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

Using the same technique that does not access the popoverPresentationController causes UIKit to throw an exception saying "Location must be provided for this popup".

in conclusion

We have found that when UIKit's view controller is displayed in a compact-width environment that is exposed in a normal-width environment, the behavior becomes very confusing. The general rules for pop-up windows are shown as pop-up windows at regular widths and full-screen at compact widths (although it makes more sense to combine the current context with upper and lower environments). The display of the operation list and the activity view controller is a bit like the pop-up window display, but it should not be displayed exactly according to the general rules.

The actual behavior seems to be the same as the human-computer interaction guide, and largely ignores the Size class of the feature set. UIKit does not show a popup on the exception warning of the operation list. The Size class does not control everything.

We cannot reproduce the behavior of Pages. For us, when a form shows an active view controller, it will be displayed as a popup window. I reported this to Apple (Radar: Can't show activity view controller filling a form sheet ).

Electroplating Rectifier Equipment

Plating Power Supply,Chrome Plating Power Supply,Copper Plated Ower Supply,Zinc-Ni Crs Power Supply

Shaoxing Chengtian Electronic Co., Ltd. , https://www.ctnelectronicpower.com