사전에 알고 있어야할 개념

  1. CGRect 타입에 대한 이해
let size:CGSize = CGSize(width: <#T##CGFloat#>, height: <#T##CGFloat#>)
let point:CGPoint = CGPoint(x: <#T##CGFloat#>, y: <#T##CGFloat#>)

let frame:CGRect = CGRect(origin: <#T##CGPoint#>, size: <#T##CGSize#>)
let bounds:CGRect = CGRect(origin: <#T##CGPoint#>, size: <#T##CGSize#>)

위 코드에서 알 수 있듯이, CGRect 타입의 경우 매개변수로 CGPointCGSiz 타입을 받는데 이는 각각 좌표와 사이즈(해당 뷰의 크기)에 해당하는 값이다.

  1. 좌표(CGPoint)
  1. 원점의 위치가 뷰의 좌측 최상단에 위치한다는 점
  2. y값이 증가하면 원점을 기준으로 아래로 이동한다는 점 을 유의해야 한다.
  3. 사이즈(CGSize)

Frame, Bounds의 공통점과 차이점

  1. 공통점
  1. 차이점1 : 좌표를 잡는 기준

<aside> 💡 - Frame *The frame rectangle, which describes the view’s location and size in its superview’s coordinate system.

-* Bounds The bounds rectangle, which describes the view’s location and size in its own coordinate system.

</aside>