[Objective-c] 016_UI Chapter _uiview

Source: Internet
Author: User

The UI elements (buttons, lists, pictures ...) that we can see on the screen when we use the app, which we call views, are inherited and UIView, they usually have properties such as location, size, background color, and in Appl View and window show the user interface of the application, and also responsible for interface interaction.

1. Coordinates and geometry of the view

[1]. Coordinate system, in Uikit the default coordinate system sets the origin in the upper-left corner, the x-axis expands to the right, and the y-axis scales down. in addition to the screen with a coordinate system, Windows and views also define their own local coordinate system, which allows us to specify the coordinates relative to the view or window origin instead of the screen uikit.

  

[2]. Geometry,cgpoint, cgsize, cgrect These structures are not explained much, uikit in the View object using frame, bounds and center properties to determine the size and position.

  

    • The Frame property contains a frame rectangle that specifies the size and position of the view in the parent view coordinate system.
    • The Center property contains a known central point in the parent view coordinate system.
    • The bounds property contains a bounding rectangle that specifies the dimensions of the view in the view's local coordinate system

2. Dots and pixels

    • In iOS, all coordinate values and distances are specified to use floating-point numbers whose cell values are called points. The number of points varies with the device and is not related to each other. The main point to understand about points is that they provide a fixed framework for drawing.
    • Each device that uses a point-based measurement system defines a user coordinate space. This is the standard coordinate space that almost all of your code will use. For example, when you want to manipulate the geometry of a view or call the core graphics method to draw content, it uses a point and user coordinate space. Even if the coordinates in the user's coordinate space are sometimes mapped directly to the pixels on the device screen, you should never assume that this is always the same. Instead, you should remember that a point does not necessarily correspond to a pixel on the screen

This site article is for baby bus SD. Team Original, reproduced must be clearly noted: (the author's official website: Baby bus )

Reprinted from "Baby bus Superdo Team" original link: http://www.cnblogs.com/superdo/p/4735555.html

[Objective-c] 016_UI Chapter _uiview

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.