zoukankan      html  css  js  c++  java
  • View Architecture Fundamentals

    A view object defines a rectangular region on the screen and handles the drawing and touch events in that region. A view can also act as a parent for other views and coordinate the placement and sizing of those views. The UIView class does most of the work in managing these relationships between views, but you can also customize the default behavior as needed.

     

    UIView<-->CALayer

    Views work in conjunction with Core Animation layers to handle the rendering and animating of a view’s content. Every view in UIKit is backed by a layer object (usually an instance of the CALayer class), which manages the backing store for the view and handles view-related animations. Most operations you perform should be through the UIView interface. However, in situations where you need more control over the rendering or animation behavior of your view, you can perform operations through its layer instead.

     

     layer object ->Core Animation rendering object -> the hardware buffers

    Behind those layer objects are Core Animation rendering objects and ultimately the hardware buffers used to manage the actual bits on the screen.

     

    Changing the size of a parent view has a ripple effect that can cause the size and position of any subviews to change too. When you change the size of a parent view, you can control the resizing behavior of each subview by configuring the view appropriately. Other changes that affect subviews include hiding a superview, changing a superview’s alpha (transparency), or applying a mathematical transform to a superview’s coordinate system.

     

    The arrangement of views in a view hierarchy also determines how your application responds to events. When a touch occurs inside a specific view, the system sends an event object with the touch information directly to that view for handling. However, if the view does not handle a particular touch event, it can pass the event object along to its superview. If the superview does not handle the event, it passes the event object to its superview, and so on up the responder chain. Specific views can also pass the event object to an intervening responder object, such as a view controller. If no object handles the event, it eventually reaches the application object, which generally discards it.

  • 相关阅读:
    51. N皇后-递归dfs+回溯-困难
    Python基础/注意事项
    22. 括号生成-递归dfs回溯-中等难度
    40. 组合总和 II-递归dfs+剪枝-中等难度
    90. 子集 II-递归+dfs-中等难度
    78. 子集-递归+dfs-中等难度
    871. 最低加油次数-贪心-困难
    T-SQL 日期函数
    T-SQL DISTINCT子句 去重复
    T-SQL 数值函数
  • 原文地址:https://www.cnblogs.com/cocoabanana/p/5555320.html
Copyright © 2011-2022 走看看