• 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.

  • 相关阅读:
    JavaScript一个页面中有多个audio标签,其中一个播放结束后自动播放下一个,audio连续播放
    JavaScript多个音频audio标签或者多个视频video,点击其中一个播放时,其他的停止播放
    JavaScript多个h5播放器video,点击一个播放其他暂停
    jQuery表单2
    CSS3-渐变这个属性2
    微信小程序——扫码后提示“打开失败缺少ID”
    js隐藏button
    js 跳转链接的几种方式
    使用onclick报SyntaxError: identifier starts immediately after numeric literal
    jsp中获取attribute
  • 原文地址:https://www.cnblogs.com/cocoabanana/p/5555320.html
Copyright © 2020-2023  润新知