iOS 44

[ iOS ] ๋ฐ์ดํ„ฐ ์ „๋‹ฌ : (1/5) Property๋กœ ์ „๋‹ฌํ•˜๊ธฐ

๋ฌธ์ œ ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ฐ์ดํ„ฐ ์ „๋‹ฌํ•˜๊ธฐ 1. Property๋กœ ์ „๋‹ฌํ•˜๊ธฐ 2. DelegatePattern์œผ๋กœ ์ „๋‹ฌํ•˜๊ธฐ 3. NotificationCenter๋กœ ์ „๋‹ฌํ•˜๊ธฐ 4. Closure๋กœ ์ „๋‹ฌํ•˜๊ธฐ 5. ์žฅ๋‹จ์  ์ •๋ฆฌ Property๋กœ ์ „๋‹ฌํ•˜๊ธฐ 1 - 2 ํ™”๋ฉด ์ „ํ™˜ํ•  ๊ฒฝ์šฐ, 1์˜ ViewContorller์—์„œ 2์˜ ViewController์˜ ํ”„๋กœํผํ‹ฐ์— ๋ฐ์ดํ„ฐ๋ฅผ ํ• ๋‹นํ•ด ์ „๋‹ฌํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. ๋ฐ์ดํ„ฐ ํ• ๋‹น์€ ๋ณดํ†ต ํ™”๋ฉด ์ „ํ™˜ ์‹œ ์ด๋ฃจ์–ด์ง€๋ฉฐ, ๊ทธ๋•Œ ์ƒ์„ฑํ•˜๋Š” 2์˜ ViewController ๊ฐ์ฒด๋ฅผ ํ™œ์šฉํ•œ๋‹ค. ๋จผ์ € 1์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•  TextField์˜ ์•„์šธ๋ › ๋ณ€์ˆ˜(contentTextField)์™€ ํ™”๋ฉด ์ „ํ™˜์„ ํ•  Button์˜ ์•ก์…˜ ํ•จ์ˆ˜(tapNextButton)๋ฅผ ์ •์˜ํ•œ๋‹ค. import UIKit class Pr..

iOS 2022.06.20

[ iOS ] ์‚ฌ์ง„ ์„ ํƒ ์‹œ ๋ฒˆํ˜ธ ํ‘œ๊ธฐ(๋„˜๋ฒ„๋ง) ๊ตฌํ˜„ (+ collectionView)

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ ์‚ฌ์ง„ ์„ ํƒ ์‹œ ๋ฒˆํ˜ธ ํ‘œ๊ธฐ(๋„˜๋ฒ„๋ง) ๊ตฌํ˜„ํ•˜๊ธฐ. ํŠน์ • ์‚ฌ์ง„ ์„ ํƒ ํ•ด์ œ ์‹œ ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์ „์ฒด ๋ฒˆํ˜ธ ํ‘œ๊ธฐ์— ๋ฐ˜์˜๋˜์–ด์•ผ ํ•œ๋‹ค. 1. cell ๋‚ด ๋ฒ„ํŠผ ์„ ํƒ ์ด๋ฒคํŠธ 2. ํŠน์ • ์‚ฌ์ง„ ์„ ํƒ ๋ชฉ๋ก์— ์ถ”๊ฐ€ํ•˜๊ธฐ 3. ํŠน์ • ์‚ฌ์ง„ ์„ ํƒ ํ•ด์ œํ•˜๊ธฐ 4. ์ž‘์—…์„ ๊ตฌํ˜„ํ•˜๋ฉด์„œ ๊ฒฝํ—˜ํ–ˆ๋˜ ์˜ค๋ฅ˜ 5. ๊ฐœ์„ ํ•  ๋งŒํ•œ ๋ถ€๋ถ„ 1. cell ๋‚ด ๋ฒ„ํŠผ ์„ ํƒ ์ด๋ฒคํŠธ [ iOS ] cell ๋‚ด ๋ฒ„ํŠผ ์„ ํƒ ์ด๋ฒคํŠธ ๊ตฌํ˜„ (+ Delegate ํŒจํ„ด) ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ ์‚ฌ์ง„ ๋‚ด ๋ฒ„ํŠผ ์„ ํƒํ•˜๊ธฐ 1. cell ๋‚ด ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฐœ์ƒ์‹œํ‚ค๊ธฐ UICollectionViewControllerDelegate์˜ collectionView(_:didSelectItemAt:) ๋ฉ”์„œ๋“œ๋ฅผ ํ†ตํ•ด collectionView C.. 8..

iOS 2022.06.15

[ iOS ] cell ๋‚ด ๋ฒ„ํŠผ ์„ ํƒ ์ด๋ฒคํŠธ ๊ตฌํ˜„ (+ Delegate ํŒจํ„ด)

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ ์‚ฌ์ง„ ๋‚ด ๋ฒ„ํŠผ ์„ ํƒํ•˜๊ธฐ 1. cell ๋‚ด ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๋ฐœ์ƒ์‹œํ‚ค๊ธฐ UICollectionViewControllerDelegate์˜ collectionView(_:didSelectItemAt:) ๋ฉ”์„œ๋“œ๋ฅผ ํ†ตํ•ด collectionView Cell์˜ ์„ ํƒ ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด ์ด๋ฒคํŠธ๋Š” cell์˜ ์ด๋ฒคํŠธ๋ฅผ ์˜๋ฏธํ•˜์ง€ cell ๋‚ด ๋ฒ„ํŠผ์˜ ์ด๋ฒคํŠธ๋ฅผ ์˜๋ฏธํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค. ์šฐ๋ฆฌ๋Š” ๋ฒ„ํŠผ์ด cell ๋‚ด์— ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ณ  ์žˆ์–ด์•ผ ํ•œ๋‹ค. collectionView(_:didSelectItemAt:) ๋ธ๋ฆฌ๊ฒŒ์ดํŠธ์— ํŠน์ •ํ•œ ์ธ๋ฑ์Šค์˜ ์•„์ดํ…œ์ด ์„ ํƒ๋˜์—ˆ์Œ์„ ์•Œ๋ฆฐ๋‹ค. ๋ฒ„ํŠผ์— ์„ ํƒ ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ํ•ด๋‹นํ•˜๋Š” ์•ก์…˜ ํ•จ์ˆ˜๊ฐ€ ํ˜ธ์ถœ๋˜๋ฏ€๋กœ, ์•ก์…˜ํ•จ์ˆ˜ ๋‚ด์— ์‚ฌ์ง„์„ ์„ ํƒํ•˜๋Š” ์ž‘์—…์„ ๊ตฌํ˜„ํ•˜๋ฉด ๋œ๋‹ค. ํ•˜..

iOS 2022.06.14

[ iOS ] URL ์ด๋ฏธ์ง€ ๋ฐ›์•„์˜ค๊ธฐ + Alamofire

๋ฌธ์ œ Alamofire๋ฅผ ์‚ฌ์šฉํ•ด URL์—์„œ ์ด๋ฏธ์ง€ ๋ฐ›์•„์˜ค๊ธฐ Unsplash์™€ ๊ฐ™์€ Open API๋‚˜ ์„œ๋ฒ„์—์„œ ์‚ฌ์ง„์„ ๋ฐ›์„ ๊ฒฝ์šฐ URL์„ UIImage๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ์ž‘์—…์„ ์ฒ˜๋ฆฌํ•ด์•ผํ•œ๋‹ค. ๋ณดํ†ต Data(constentsOf:)๋ฅผ ์‚ฌ์šฉํ•˜์ง€๋งŒ ๊ณต์‹๋ฌธ์„œ์—์„œ๋Š” URLSession ์‚ฌ์šฉ์„ ๊ถŒ์žฅํ•œ๋‹ค. ์˜ค๋Š˜์€ URLSession์„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ Alamofire๋ฅผ ํ†ตํ•ด URL์—์„œ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์˜ค์ž. [ iOS ] URL๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„ ์˜ฌ ๊ฒฝ์šฐ Data(contentsOf:)๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์•ˆ ๋˜๋Š” ์ด์œ  ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ ๋„คํŠธ์›Œํฌ ๊ธฐ๋ฐ˜์˜ URL ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์˜ฌ ๋•Œ Data(contentsOf:)๋ฅผ ์‚ฌ์šฉํ•ด๋„ ๋ ๊นŒ? 1. Data(contentsOf:) NSData(constentsOf:)๋Š” ์ฃผ์–ด์ง„ URL..

iOS 2022.06.08

[ iOS ] URL๋กœ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„ ์˜ฌ ๊ฒฝ์šฐ Data(contentsOf:)๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์•ˆ ๋˜๋Š” ์ด์œ 

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ ๋„คํŠธ์›Œํฌ ๊ธฐ๋ฐ˜์˜ URL ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์˜ฌ ๋•Œ Data(contentsOf:)๋ฅผ ์‚ฌ์šฉํ•ด๋„ ๋ ๊นŒ? 1. Data(contentsOf:) NSData(constentsOf:)๋Š” ์ฃผ์–ด์ง„ URL๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ์ดํ„ฐ ๊ฐ์ฒด๋กœ ์ดˆ๊ธฐํ™”ํ•˜๋Š” ์ž‘์—…์ด๋‹ค. ๋”ฐ๋ผ์„œ ์ด ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•ด URL๋กœ๋ถ€ํ„ฐ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์˜จ๋‹ค๋ฉด ์ž˜ ์ž‘๋™ํ•œ๋‹ค. ํ•˜์ง€๋งŒ ํ•ด๋‹น ๋ฉ”์„œ๋“œ์˜ ๊ณต์‹๋ฌธ์„œ์—๋Š” ๋„คํŠธ์›Œํฌ ๊ธฐ๋ฐ˜์˜ URL์˜ ๊ฒฝ์šฐ ํ•ด๋‹น ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง๋ผ๊ณ  ๋ช…์‹œ๋˜์–ด์žˆ๋‹ค. [ iOS ] NSData(contentsOf:) init(contentsOf:) ์ฃผ์–ด์ง„ URL๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ์ดํ„ฐ ๊ฐ์ฒด๋ฅผ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค. Technology Foundation Declaration init?(contentsOf url: URL) Parame..

iOS 2022.06.07

[ iOS ] CollectionView ๊ฐ„๊ฒฉ ์กฐ์ •ํ•˜๊ธฐ

๋ฌธ์ œ ๊ฐ€๋กœ ๋ฐฉํ–ฅ์˜ CollectionView์—์„œ cell์˜ ๊ฐ„๊ฒฉ์„ ์กฐ์ •ํ•˜๊ธฐ CollectionView์˜ cell ๊ฐ„ ๊ฐ„๊ฒฉ์„ ์„ค์ •ํ•ด์ฃผ๊ธฐ ์œ„ํ•ด์„œ๋Š” UICollectionViewDelegateFlowLayout ํ”„๋กœํ† ์ฝœ์˜ ๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. collectionView(_:layout:minimumLineSpacingForSectionAt:) ํ•œ ์„น์…˜์˜ ์—ฐ์†์ ์ธ ํ–‰ ๋˜๋Š” ์—ด ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ์„ ์ง€์ •ํ•œ๋‹ค. collectionView(_:layout:minimumInteritemSpacingForSectionAt:) ํ•œ ์„น์…˜์˜ ๋™์ผ ํ–‰ ๋˜๋Š” ์—ด์—์„œ ์•„์ดํ…œ๋“ค์˜ ๊ฐ„๊ฒฉ์„ ์ง€์ •ํ•œ๋‹ค. scroll Direction๋”ฐ๋ฅธ ๋ฉ”์„œ๋“œ ์‚ฌ์šฉ 1. ๊ฐ€๋กœ ๋ฐฉํ–ฅ ์Šคํฌ๋กค์ผ ๊ฒฝ์šฐ, horizontally collectionView(_:layo..

iOS 2022.05.10

[ iOS ] isEnabled์™€ isUserInteractionEnabled ๋น„๊ต

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ๊ธ€๋กœ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ isEnabled์™€ isUserInteractionEnabled๋Š” ๋ฌด์Šจ ์ฐจ์ด๊ฐ€ ์žˆ์„๊นŒ? 1. isEnabled ๋ž€? ํ•ด๋‹น ์ปจํŠธ๋กค์ด ํ™œ์„ฑํ™” ์ƒํƒœ์ธ์ง€ ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” Boolํƒ€์ž…์˜ ํ”„๋กœํผํ‹ฐ UIController์˜ ์ธ์Šคํ„ด์Šค ํ”„๋กœํผํ‹ฐ. UIController๋Š” UIButton์˜ ๋ถ€๋ชจ ํด๋ž˜์Šค์ด๋‹ค. true : ํ•ด๋‹น ์ปจํŠธ๋กค์„ ํ™œ์„ฑํ™”ํ•œ๋‹ค. false : ํ•ด๋‹น ์ปจํŠธ๋กค์„ ๋น„ํ™œ์„ฑํ™”ํ•œ๋‹ค. ํ™œ์„ฑํ™”๋œ ์ปจํŠธ๋กค์€ ์‚ฌ์šฉ์ž์™€์˜ ์ƒํ˜ธ์ž‘์šฉ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค. 2. isUserInteractionEnabled ๋ž€? ์‚ฌ์šฉ์ž ์ด๋ฒคํŠธ๋ฅผ ๋ฌด์‹œํ•˜๊ณ  ์ด๋ฒคํŠธ ํ์—์„œ ์ œ๊ฑฐํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” Bool ํƒ€์ž…์˜ ํ”„๋กœํผํ‹ฐ์ด๋‹ค. UIView์˜ ์ธ์Šคํ„ด์Šค ํ”„๋กœํผํ‹ฐ. UIView๋Š” UIController์˜ ๋ถ€๋ชจ ํด๋ž˜์Šค์ด๋‹ค. ..

iOS 2022.04.12

[ iOS ] Present๋œ ํ™”๋ฉด ๋‚ด๋ฆฐ ํ›„ ์ฒ˜์Œ ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ (popToRootViewController, present, dismiss)

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€ ๋ฌธ์ œ navigationController๋ฅผ ์‚ฌ์šฉํ•˜๋‹ค๊ฐ€ Present Modally๋ฅผ ํ•œ ๊ฒฝ์šฐ ๋ฒ„ํŠผ ํด๋ฆญ ์‹œ ๋‹ค์‹œ ์ฒ˜์Œ ํ™”๋ฉด(RootViewController)์œผ๋กœ ๋˜๋Œ์•„๊ฐ€๊ธฐ A(navigationController) -push- B -Present- C C ๊ฐ€ Present๋œ Modal์ด๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ์ € dismiss()๋ฉ”์„œ๋“œ๋งŒ ํ˜ธ์ถœํ•œ๋‹ค๋ฉด B ํ™”๋ฉด์œผ๋กœ ๋Œ์•„๊ฐˆ ๋ฟ์ด๋‹ค. ๊ทธ๋ ‡๋‹ค๊ณ  navigationController๊ฐ€ ์•„๋‹Œ C ํ™”๋ฉด์—์„œ UINavigaionController์˜ popToRootViewController()๋ฉ”์„œ๋“œ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜๋Š” ์—†๋‹ค. ์œ„ ํ™”๋ฉด์˜ ์ˆœ์„œ๋ฅผ ๋ณด๋ฉด A - B ๋Š” NavigationController์˜ navigation Stack์— ์Œ“์ธ๋‹ค. ๋”ฐ๋ผ์„œ popToR..

iOS 2022.04.12

[iOS] viewController Life Cycle ์ƒ๋ช…์ฃผ๊ธฐ

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. UIViewController๋Š” ๋ทฐ๋ฅผ ๊ด€๋ฆฌํ•˜๊ฑฐ๋‚˜ ์ด๋ฒคํŠธ์™€ ๊ด€๋ จํ•ด ๋ทฐ์— ์‘๋‹ตํ•˜๋Š” ๋ฉ”์„œ๋“œ๋“ค์ด ์ •์˜๋˜์–ด ์žˆ๋‹ค. ์ด ๋ฉ”์„œ๋“œ๋“ค์€ view Controller์— ์˜ํ•ด ๋ถˆ๋Ÿฌ์ ธ์•ผํ•˜๋Š” ์ˆœ๊ฐ„์— ์ž๋™์œผ๋กœ ํ˜ธ์ถœ๋˜๊ธฐ ๋•Œ๋ฌธ์— ๋ณ€ํ™”์— ๋Œ€์‘ํ•  ์ˆ˜ ์žˆ๋‹ค. UIViewController๋ฅผ ์ƒ์†๋ฐ›๋Š” ๊ฒฝ์šฐ ์ด ๋ฉ”์„œ๋“œ๋“ค์„ ์˜ค๋ฒ„๋ผ์ด๋“œ ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ ์ด๋ฅผ ํ†ตํ•ด ๋ทฐ ๋ณ€ํ™”๋งˆ๋‹ค ์ทจํ•  ์•ก์…˜์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ทฐ์˜ ์ƒํƒœ Appearing : ๋ทฐ๊ฐ€ ํ™”๋ฉด์— ๋‚˜ํƒ€๋‚˜๋Š” ์ค‘ Appreared : ๋ทฐ๊ฐ€ ํ™”๋ฉด์— ๋‚˜ํƒ€๋‚˜๋Š” ๊ฒƒ์ด ์™„๋ฃŒ๋œ ์ƒํƒœ Disappearing : ๋ทฐ๊ฐ€ ํ™”๋ฉด์—์„œ ์‚ฌ๋ผ์ง€๋Š” ์ค‘ Disappreared : ๋ทฐ๊ฐ€ ํ™”๋ฉด์—์„œ ์‚ฌ๋ผ์ง„ ์ƒํƒœ LifeCycle ๋ฉ”์„œ๋“œ ํ˜ธ์ถœ ์ˆœ์„œ 1. viewDidLoad() → 2. viewWill..

iOS 2022.03.20

[iOS] ์•ฑ ๋‚ด์—์„œ ์ธ์Šคํƒ€๊ทธ๋žจ ์‹คํ–‰ํ•˜๊ธฐ (๋ฒ”์šฉ๋งํฌ Universal Link / UIApplication / URL scheme)

๋ฌธ์ œ ์•ฑ ๋‚ด์—์„œ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด ์„ค์ •๋œ ์ธ์Šคํƒ€๊ทธ๋žจ ๊ณ„์ • ํ”„๋กœํ•„๋กœ ์ด๋™ํ•˜๊ธฐ @IBAction func tapBtnInstagram(_ sender: UIButton) { //1 let instagram = "https://www.instagram.com/lazy_cookie_lazy" //2 let instagramURL = NSURL(string: instagram) //3 if UIApplication.shared.canOpenURL(instagramURL! as URL) { //4 UIApplication.shared.open( //5 instagramURL! as URL, options: [:], completionHandler: nil ) } } 1. ์›ํ•˜๋Š” ๋ฒ„ํŠผ์˜ ์•ก์…˜ํ•จ์ˆ˜๋ฅผ ์ƒ์„ฑํ•œ๋‹ค. 2. ์ธ์Šคํƒ€..

iOS 2022.03.13

[ iOS ] UIImageView ํด๋ฆญ ์‹œ ํ™”๋ฉด ์ „ํ™˜ - UITapGestureRecognizer

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋ฌธ์ œ UIImageView ํด๋ฆญ ์‹œ ํ™”๋ฉด ์ „ํ™˜๋˜๋„๋ก ๊ตฌํ˜„ UIImageView๋ฅผ ํด๋ฆญํ•ด ํ™”๋ฉด์ „ํ™˜ ์•ก์…˜์„ ์ˆ˜ํ–‰ํ•˜๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” UITapGestureRecogniger๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. https://88yhtserof.tistory.com/40 [ iOS ] UITapGestureRecogniger UITapGestureRecogniger ๋‹จ์ผ ๋˜๋Š” ๋‹ค์ค‘์˜ tap์„ ํ•ด์„ํ•˜๋Š” ๊ฐœ๋ณ„ gersture recognizer. UITapGestureRecognizer๋Š” UIGestureRecognizer์˜ ๊ตฌ์ฒด์ ์ธ ํ•˜์œ„ ํด๋ž˜์Šค์ด๋‹ค. gersture recognizer์˜ ๊ฒฝ์šฐ, ์ง€์ •๋œ ์ˆ˜์˜ ์†.. 88yhtserof.tistory.com storyboard๋ฅผ ์‚ฌ์šฉํ•ด tapํ•  imag..

iOS 2022.01.18

[ iOS ] layout subviews๊ด€๋ จ ๋ฉ”์„œ๋“œ - viewWillLayoutSubviews, layoutSubviews, viewDidLayoutSubviews

๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค. ๋‚˜: ๋‚ด๊ฐ€ ์ดํ•ดํ•œ ๋‚ด์šฉ layout subviews ๊ด€๋ จ ๋ฉ”์„œ๋“œ layout subviews๊ด€๋ จ ๋ฉ”์„œ๋“œ๋ž€? layout subViews ๊ด€๋ จ ๋ฉ”์„œ๋“œ ์ข…๋ฅ˜ 1. layout subviews๊ด€๋ จ ๋ฉ”์„œ๋“œ๋ž€? ViewController๊ด€๋ จ ๋ฉ”์„œ๋“œ์ธ viewDidLoad, ViewWillAppear, ViewDidAppear ๋ฉ”์„œ๋“œ๊ฐ€ ๋ทฐ๊ฐ€ ํ™”๋ฉด์— ๋ณด์ผ ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ, ๋ ˆ์ด์•„์›ƒ์ด ํ™”๋ฉด์— ๋ณด์ผ ๋•Œ ํ˜ธ์ถœ๋˜๋Š” ๋ฉ”์„œ๋“œ์ด๋‹ค. ํ˜ธ์ถœ ์ˆœ์„œ(๋ ˆ์ด์•„์›ƒ ๊ฒฐ์ • ์ˆœ์„œ) viewWillLayoutSubviews() -> layoutSubviews() -> viewDidLayoutSubviews() 2. layout subViews ๊ด€๋ จ ๋ฉ”์„œ๋“œ ์ข…๋ฅ˜ 2.1 viewWillLayoutSubviews() ..

iOS 2021.09.27
728x90