iOS) Frame과 Bounds의 차이점

JeongYeongJoon·2023년 6월 3일

iOS_Interview

목록 보기
1/15
post-thumbnail

Swift 레퍼런스 문서에는 다음과 같이 설명되어있다.

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.

두 가지 모두 뷰의 위치와 사이즈를 반환하는 CGRect 타입 변수인 것은 동일하나, 기준 좌표계가 다르다.

Frame: 부모 뷰 (Super View)의 좌표계를 이용해 뷰의 위치와 크기를 나타내는 좌표

Bounds: 자신만의 좌표계를 이용해 뷰의 위치와 크기를 나타내는 좌표

참고 사이트

[iOS] Bounds 와 Frame 의 차이점을 설명하시오.

profile
iOS와 Swift, SwiftUI를 공부하기 위해 블로그를 운영 중입니다.

0개의 댓글