美文网首页
UIView 01 - frame, bounds, cente

UIView 01 - frame, bounds, cente

作者: dzhou3 | 来源:发表于2017-08-13 16:36 被阅读0次

    最近发现UIView最基本的一些内容都没有理解好,因此打算阅读官方文档的同时也把自己所学习的记录下来。
    https://developer.apple.com/documentation/uikit/uiview

    frame,bounds,center是UIView对象的几个位置属性,下面是官方文档中对这几个属性的定义。

    The geometry of each view is defined by its frame and bounds properties.The frame property defines the origin and dimensions of the view in the coordinate system of its superview.The bounds property defines the internal dimensions of the view as it sees them and is used almost exclusively in custom drawing code.The center property provides a convenient way to reposition a view without changing its frame or bounds properties directly.

    frame: 描述当前视图在其父视图中的坐标位置和大小,用于确定与视图层次结构中其他视图的相对位置,从而将自己的图层与其他视图的图层正确组合成屏幕上的图像。

    bounds: 描述当前视图在其自身坐标系统的位置和大小,用于确定绘制区域,避免将自己绘制到图层边界之外。

    center: 描述当前视图的中心在其父视图中的位置

    相关文章

      网友评论

          本文标题:UIView 01 - frame, bounds, cente

          本文链接:https://www.haomeiwen.com/subject/bederxtx.html