ios 52

[ 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
728x90