2.3 Automatic adaptation and layout (adaptivity and layout) 2.3.1 developed to Auto-fit (Build in adaptivity)
Users often want to use their favorite apps in all their devices, in a variety of scenarios. For example, the different directions of different devices and the split screen on the ipad. The size type (size Classes) and auto layout can help you achieve this by defining the layout of the screen, the view controller, and how the view will fit when the screen shows the environment changes. (the "Display environment" here can be a whole screen or part of a screen, such as a part of a popup box or a split screen on an ipad.) )
The conceptual definition of the display environment in iOS is defined in the feature set (Trait Collection), which contains the dimension type (size Classes), the display scale, and the UI language (user Interface Idiom). You can use a feature set to let your view and view controller respond to the changes in the environment. (For more information on trait collection, refer to Uitraitcollection Class Reference.)
iOS defines two types of dimensions: Regular (Regular) and compact. General dimensions are generally associated with a wide space, while compact dimensions are associated with confined spaces. To describe the display environment, you need to define a horizontal dimension class and a vertical dimension class. As you can imagine, iOS uses a set of dimension classes while on the vertical screen, and another set of dimension classes on a horizontal screen.
iOS can automatically make many layout adjustments when the size type (size Classes) and the display environment change. For example, when a vertically oriented dimension class changes from compact to regular, the navigation bar and toolbar automatically become taller.
When you make a layout change with a size class, your app can be displayed in any environment. To learn how to build a user interface from a size class, refer to Size classes Design help.
Note: In a dimension class, you can continue to use automatic layout to make minor adjustments, such as stretching or narrowing the content. To learn how to use automatic layouts, refer to Auto layout guide.
The following examples give you a more intuitive understanding of how dimension classes depict the display environment for different devices. For example, the ipad (including ipad Pro), regardless of size, vertical screen, horizontal screen is a regular size type. In other words, the ipad's display environment in both horizontal and vertical directions is always regular.
Note: On a multi-tasking ipad model, your app may share the screen with another app. Be sure to use auto layout so you can respond to user requests for multitasking, such as split View and side screen (Slide over).
In addition to using automatic layout, it is equally important to set the Readablecontentguide property of your layout by setting UIView, which allows users to have a better reading experience.
There are differences in the display environment of the iphone, which is mainly determined by the device model and holding direction.
When vertical, the IPhone6 plus uses a compact and vertically normal size type, while a horizontal normal and vertical compact size type is used for horizontal screen.
Other iphone models, including IPhone6, use the same set of dimension types.
On vertical screens, the iphone6,iphone5,iphone4s uses a horizontal compact and vertical normal size type. Horizontally and vertically, these devices are compact size types.
2.3.2 always offers a good experience (provide a greate Experience in each environment)
When you understand the benefits of automatic adaptation, you can be sure to respond appropriately when a display environment changes. Follow these guidelines to bring a good experience to your users in any device environment.
- stay focused on the main content in all environments. This is the highest priority, and users use your app to focus on what they care about. Changing the focus when the environment changes will confuse the user and feel the loss of control over the app.
- avoid unnecessary changes on the layout. use a similar experience in all environments so that users can maintain their operating habits when rotating devices or running your app on other devices. For example, you don't need to display the same content in a horizontal, compact environment, even though you've resized the grid, in a horizontal, regular environment, with a single grid of images.
- If your app supports only one direction, then just a little bit. users always want your app to be able to support different directions, but it's best to meet this point. But if your app can only be used in one Direction, you should:
- avoid the elements that will prompt the user to rotate the device. run in the direction of support and, if necessary, clearly tell the user to rotate the device, but only if there is no clutter involved.
- support changes in the same direction. For example, if an app is only supported in the horizontal direction, then whether the home key is on the left or the right side should be able to run normally. If the user rotates the device 180 degrees, the application's content is also rotated 180 degrees to respond to the user's actions.
- If you take a change in the direction of the device as a type of user input, you should rotate it in a program-specific way. For example, a game that allows a user to rotate an object in the game by rotating the screen will not be able to respond to screen rotation. In this case, you have to correlate two directions that need to change and allow the user to switch between them until they begin to apply the main task. Start the main task, and then start responding to the device's movement. (WTF, this translation can not understand)
2.3.3 to communicate with layouts (using layout to communicate)
The layout is not just a UI element in the interface, but through the layout, you can tell the user what information is most important, what their choices are, and how everything is linked together.
- by highlighting important content and functionality, it makes it easier for users to focus on the main tasks. some good practice is to put important items in the upper part of the screen and follow the habits from left to right.
- Use visual weights and balances to tell users which elements on the screen are relatively important.
Recommended not recommended
"Translate" UI design basics (UI designer Basics)-automatic adaptation and layout (adaptivity and layouts) (iv)