Do I have the right understanding of frames and bounds in UIKit?

后端 未结 5 1952
深忆病人
深忆病人 2020-12-23 20:55

Let me try to explain it. Please tell me if I am wrong. I am just 70% sure about it.

Like I understand it, an UIView has a frame and an bounds rectangle. The job of

5条回答
  •  别那么骄傲
    2020-12-23 21:09

    Yes you are right.

    When you need to use the view, then you use the frame; the bounds are used to actually implement the view. As an example, you need to use the bounds to draw a view or to handle touch events. Instead, you use the frame when creating a view or positioning a view in its superview etc.

提交回复
热议问题