๐Ÿ“ฑ iOS

๋ฉด์ ‘์Šคํ„ฐ๋”” Day1(Frame, Bounds, ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ)

Kiwi๐Ÿ’ป 2022. 10. 25. 22:42

Bounds ์™€ Frame ์˜ ์ฐจ์ด์ ์„ ์„ค๋ช…ํ•˜์‹œ์˜ค

Frame

  • The frame rectangle, which describes the viewโ€™s location and size in its superviewโ€™s coordinate system.
  • ์ƒ์œ„๋ทฐ์˜ ์ขŒํ‘œ๊ณ„๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋ทฐ์˜ ์œ„์น˜์™€ ํฌ๊ธฐ๋ฅผ ํ‘œํ˜„
  • ๋งŒ์•ฝ Frame์˜ ์ขŒํ‘œ๊ฐ’์ด (50,60)์ด๋ผ๋ฉด, ์ƒ์œ„๋ทฐ๋ฅผ ๊ธฐ์ค€์œผ๋กœ x 50, y 60๋งŒํผ ๋–จ์–ด์ง„ ๊ณณ์— ์œ„์น˜ํ•˜๊ณ  ์žˆ๋‹ค๋Š” ๋œป์ด๋‹ค.
  • ๋ทฐ๋ฅผ ํšŒ์ „ํ•˜๋ฉด ํ•ด๋‹น ๋ทฐ๋ฅผ ๋ชจ๋‘ ๊ฐ์Œ€ ์ˆ˜ ์žˆ์„ ๋งŒํผ ๊ฐ’์ด ์ปค์ง„๋‹ค.

์‚ฌ์šฉ๊ฒฝ์šฐ

  • UIView์œ„์น˜๋‚˜ ํฌ๊ธฐ๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒฝ์šฐ.

Bounds

  • The bounds rectangle, which describes the viewโ€™s location and size in its own coordinate system.
  • ์ž์ฒด ์ขŒํ‘œ๊ณ„์—์„œ ๋ทฐ์˜ ์œ„์น˜์™€ ํฌ๊ธฐ๋ฅผ ์„ค๋ช…
  • ์ƒ์œ„๋ทฐ์™€ ์•„๋ฌด๋Ÿฐ ์ƒ๊ด€์ด ์—†๋‹ค.(defualt ์ขŒํ‘œ๋Š” (0,0))

์‚ฌ์šฉ๊ฒฝ์šฐ

  • View๋‚ด๋ถ€์— ๊ทธ๋ฆผ์„ ๊ทธ๋ฆด๋•Œ (drawRect).
  • transfomation ํ›„, View์˜ ํฌ๊ธฐ๋ฅผ ์•Œ๊ณ ์‹ถ์„ ๋•Œ.
  • ํ•˜์œ„View๋ฅผ ์ •๋ ฌํ•˜๋Š” ๊ฒƒ๊ณผ ๊ฐ™์ด ๋‚ด๋ถ€์ ์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒฝ์šฐ.
  • ScrollView

๊ณตํ†ต์ 

  • UIview์˜ Property์ด๋ฉฐ CGRect ํƒ€์ž…์ด๋‹ค.

Noteโ—๏ธ

CGRect?
A structure that contains the location and dimensions of a rectangle.
์‚ฌ๊ฐํ˜•์˜ ์œ„์น˜์™€ ํฌ๊ธฐ๋ฅผ ํฌํ•จํ•˜๋Š” ๊ตฌ์กฐ์ฒด

์ถœ์ฒ˜:

https://developer.apple.com/documentation/uikit/uiview/1622621-frame
https://developer.apple.com/documentation/uikit/uiview/1622580-bounds
https://zeddios.tistory.com/203
https://zeddios.tistory.com/231

์‹ค์ œ ๋””๋ฐ”์ด์Šค๊ฐ€ ์—†์„ ๊ฒฝ์šฐ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์—์„œ ํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๊ณผ ์—†๋Š” ๊ฒƒ์„ ์„ค๋ช…ํ•˜์‹œ์˜ค.

์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ๋Š” ์•ฑ์˜ ์‹ ์†ํ•œ ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋›ฐ์–ด๋‚œ ๋„๊ตฌ๋กœ, ๋ณ€๊ฒฝ ๊ฒฐ๊ณผ๋ฅผ ๋น ๋ฅด๊ฒŒ ํ™•์ธํ•˜๊ณ , ์˜ค๋ฅ˜๋ฅผ ๋””๋ฒ„๊น…ํ•˜๊ณ , ํ…Œ์ŠคํŠธ๋ฅผ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ์™€ ์‹ค์ œ ๊ธฐ๊ธฐ ๊ฐ„์—๋Š” ํ•˜๋“œ์›จ์–ด์™€ API์˜ ์ฐจ์ด๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ ์‹ค์ œ ๊ธฐ๊ธฐ์—์„œ ์•ฑ์„ ํ…Œ์ŠคํŠธํ•˜๋Š” ๊ฒƒ๋„ ์ค‘์š”ํ•˜๋‹ค.

์ด๋Ÿฌํ•œ ์ฐจ์ด์  ์™ธ์—๋„ ์‹œ๋ฎฌ๋ ˆ์ดํ„ฐ๋Š” Mac์—์„œ ์‹คํ–‰๋˜๋Š” ์•ฑ์œผ๋กœ CPU, ๋ฉ”๋ชจ๋ฆฌ, ๋„คํŠธ์›Œํฌ ์—ฐ๊ฒฐ ๋“ฑ์˜ ์ปดํ“จํ„ฐ ๋ฆฌ์†Œ์Šค์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด๋Ÿฌํ•œ ๋ฆฌ์†Œ์Šค๋Š” ๋ฌผ๋ฆฌ์  ์žฅ์น˜์—์„œ ์‹คํ–‰๋˜๋Š” ์„ฑ๋Šฅ, ๋ฉ”๋ชจ๋ฆฌ ์‚ฌ์šฉ๋Ÿ‰ ๋ฐ ๋„คํŠธ์›Œํฌ ์†๋„ ํ…Œ์ŠคํŠธ๊ฐ€ ํ•„์š”ํ•œ ๋ชจ๋ฐ”์ผ ์žฅ์น˜์—์„œ ๋ณผ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ๊ณผ๋Š” ์šฉ๋Ÿ‰๊ณผ ์†๋„๊ฐ€ ํฌ๊ฒŒ ๋‹ค๋ฅผ ์ˆ˜ ์žˆ๋‹ค.

ํ•˜๋“œ์›จ์–ด

  • ์ฃผ๋ณ€ ๊ด‘ ์„ผ์„œ
  • ์˜ค๋””์˜ค ์ž…๋ ฅ(ํ•˜๋“œ์›จ์–ด -> Siri๋ฅผ ์„ ํƒํ•˜์—ฌ Siri๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋ฅผ ์ œ์™ธํ•˜๊ณ )
  • ๊ธฐ์••๊ณ„
  • ๋ธ”๋ฃจํˆฌ์Šค
  • ์นด๋ฉ”๋ผ
  • ๋ชจ์…˜ ์ง€์›(๊ฐ€์†๋„๊ณ„ ๋ฐ ์ž์ด๋กœ์Šค์ฝ”ํ”„)
  • ๊ทผ์ ‘ ์„ผ์„œ

API

  • ARKit
  • External Accessory
  • HomeKit
  • IOSurface
  • Media Player
  • Message UI

์ถœ์ฒ˜:

https://help.apple.com/simulator/mac/current/#/devb0244142d

'๐Ÿ“ฑ iOS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

๋ฉด์ ‘์Šคํ„ฐ๋”” Day2 (Static Dispatch, Dynamic Dispatch, DB)  (0) 2022.10.27
์ปฌ๋ ‰์…˜ ๋ทฐ  (0) 2022.07.26