๐ฑ iOS/-- UIKit (iOS) - UIKit์ Frame, Bounds ์ ์ฐจ์ด์ - ๊ณตํต์ Bounds, Frame ๋ชจ๋ View์ ์์น์ ํฌ๊ธฐ๋ฅผ ๋ํ๋ด๋ UIView์ instance property์ธ CGRect ํ์ ์ด๋ผ๋ ์ ์ด ๊ณตํต์ ์ด๋ค. var frame: CGRect {get set} var bounds: CGRect {get set} // Frame property ์ ๊ทผ view.frame.origin.x view.frame.origin.y view.frame.size.width view.frame.size.height view.bounds.origin.x view.bounds.origin.y view.bounds.size.width view.bounds.size.height Frame (Instance Property) (๋ถ๋ฅ: UIKit > Views and Controls > UIView) ํ๋ ์์ SuperView's coordinate system ์์์ View์ ์ฌ์ด์ฆ ๋ฐ ์์น๋ฅผ ๋ํ๋ธ๋ค. (superView๋ ๋ฐ๋ก ํ๋จ๊ณ ์์ ๋ทฐ๋ฅผ ์๋ฏธํ๋ค.) frame์ size๋ ๋จ์ํ UIView์ ๋์ผํ ์์น, ํฌ๊ธฐ๊ฐ ์๋๋ผ View๊ฐ ํ์ ๋์์๋๋ ๊ฐ์ ์ ์๋ ์ฌ๊ฐํ์ ํฌ๊ธฐ๋ฅผ ์๋ฏธํ๋ค. (์ฆ View๋ฅผ ํ์ ์ํค๋ฉด ํฌ๊ธฐ๊ฐ ๋ณํ ์ ์๋ค) Bounds์ ์ขํ๋ฅผ ์ฎ๊ธฐ๋ฉด subView๊ฐ ์์ง์ด๋๊ฒ ์ฒ๋ผ ๋ณด์ด๋๋ฐ, ์ด ๊ฒ์ subview๋ฅผ ๊ทธ๋ฆฌ๋ ์ขํ๊ณ์ ๊ธฐ์ค์ด ๋ฌ๋ผ์ก๊ธฐ ๋๋ฌธ์ด๋ค. Bounds (Instance Property) ๋ถ๋ฅ: UIKit > Views and Controls > UIView Bounds๋in its own coordinate system ์๊ธฐ ์์ ์ ์ขํ๊ณ๋ฅผ ๊ธฐ์ค์ผ๋ก ์์น์ ์ฌ์ด์ฆ๋ฅผ ํํํ๋ property์ด๋ค. SuperView.bounds ์ขํ๋ฅผ ์์ ํ๋ฉด, subView๊ฐ ์์ง์ธ๋ค. Bounds์ size๋ ๋จ์ํ ๋ทฐ ์์ฒด์ ํฌ๊ธฐ๋ฅผ ์๋ฏธํ๋ค. (๋ทฐ๋ฅผ ํ์ ํด๋ size๋ ๋ณํ์ง ์๋๋ค.) ์์ฝ Frame์ ์์ ๋ทฐ์ ์ขํ์ฒด๊ณ๋ฅผ ๋ฐ๋ฅธ๋ค. ๋ฐ๋ผ์ ์ผ๋ฐ์ ์ผ๋ก UIView์ ์์น, ํฌ๊ธฐ ์ค์ ํ๋ ๊ฒฝ์ฐ์ ์ฌ์ฉํ๋ค. Bounds๋ ์๊ธฐ ์์ ๋ง์ ์ขํ์ฒด๊ณ๋ฅผ ๊ฐ์ง๋ค. ๋ด๋ถ์ ํ์๋ทฐ๋ค์ ๋ณ๊ฒฝํ๋ ๊ฒฝ์ฐ์ ์ฌ์ฉํ๋ค. ๋ด๋ถ์ ๊ทธ๋ฆผ์ ๊ทธ๋ฆฌ๋ ๊ฒฝ์ฐ์ ์ฌ์ฉํ๋ค(drawRect) ์ฆ, SuperView.bounds์ origin๊ฐ์ ๋ณ๊ฒฝํ๋ฉด SuperView ์๊ธฐ ์์ ์ ์ขํ๊ณ๊ฐ ๋ณ๊ฒฝ๋๋ค. -> Subview๋ ์์ ๋ทฐ์ธ SuperView์ ์ขํ์ฒด๊ณ์ ์ํฅ์ ๋ฐ๋๋ค. -> SubView์ ์์น๊ฐ ๋ฐ๋๋ค. ์ฆ ์์๋ทฐ(blue) bounds.origin ์ (x+100,y+100)๋ก ์์ ํ๋๋.... ํ์๋ทฐ์(red)๊ฐ ๊ฐ๊ฐ (x-100, y-100)๋งํผ ์ด๋ํ๊ฒ์ฒ๋ผ ๋ ๋๋ง๋๋ค. ๊ณต์ ํ๊ธฐ URL ๋ณต์ฌ์นด์นด์คํก ๊ณต์ ํ์ด์ค๋ถ ๊ณต์ ์์ค ๊ณต์ ๊ฒ์๊ธ ๊ด๋ฆฌ ๊ตฌ๋ ํ๊ธฐnewmon Contents ๊ณตํต์ Frame(InstanceProperty) (๋ถ๋ฅ:UIKit>ViewsandControls>UIView) Bounds(InstanceProperty) ๋ถ๋ฅ:UIKit>ViewsandControls>UIView ์์ฝ ๋น์ ์ด ์ข์ํ ๋งํ ์ฝํ ์ธ (iOS) UIWindow ์ ๊ดํ์ฌ 2022.03.22 (iOS) ๋ฉ๋ชจ๋ฆฌ ์ด์ ๋๋ฒ๊น , ๋ฉ๋ชจ๋ฆฌ ๊ทธ๋ํ Xcode instrument, ๋ฉ๋ชจ๋ฆฌ ๋์ 2022.03.11 (iOS) - info.plist & appProject ( .xcodeproj ) 2021.09.09 (iOS) - Bundle : Build version์ Version์ ์ฐจ์ด์ ๊ฐ๋ 2021.09.08 ๋๊ธ 0 + ์ด์ ๋๊ธ ๋๋ณด๊ธฐ