๋ชฉ๋ก๐ฑ๐ iOS (62)
Bibi's DevLog ๐ค๐
UserDefaults ๊ณต์ ๋ฌธ์ https://developer.apple.com/documentation/foundation/userdefaults/ : ์ฑ ์คํ ๋์ ์ง์์ ์ผ๋ก ํค-๊ฐ ์์ ์ ์ฅํ ์ ์๋ ์ฌ์ฉ์์ ๊ธฐ๋ณธ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๋ํ ์ธํฐํ์ด์ค. class UserDefaults : NSObject UserDefaults๋ ๊ธฐ๋ณธ ์์คํ ๊ณผ ์ํธ์์ฉํ๊ธฐ ์ํ ํ๋ก๊ทธ๋จ์ ์ธ ์ธํฐํ์ด์ค๋ฅผ ์ ๊ณตํฉ๋๋ค. ๊ธฐ๋ณธ ์์คํ ์ ์ฑ์ด ์ฌ์ฉ์๊ฐ ์ ํธํ๋ ๋์์ ์ปค์คํฐ๋ง์ด์ฆํ๋๋ก ํด ์ค๋๋ค. ์๋ฅผ ๋ค์ด, ๋น์ ์ ์ฌ์ฉ์๊ฐ ๊ทธ๋ค์ด ์ ํธํ๋ ์ธก์ ๋จ์๋ ๋ฏธ๋์ด ์ฌ์ ์๋๋ฅผ ๊ตฌ์ฒดํํ๋๋ก ํ ์ ์์ต๋๋ค. ์ฑ์ ์ฌ์ฉ์์ ๊ธฐ๋ณธ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์๋ ํ๋ผ๋ฏธํฐ์ ์งํฉ์ ๊ฐ๋ค์ ํ ๋นํจ์ผ๋ก์จ ์ด๋ฌํ ์ ํธ๋ฅผ ์ ์ฅํฉ๋๋ค. ์ด ํ๋ผ๋ฏธํฐ๋ค์ ๊ธฐ๋ณธ..
[๊ณฐํ๊น๋] RxSwift + MVVM ์ ๋ฆฌ https://www.youtube.com/watch?v=iHKBNYMWd5I&list=PL03rJBlpwTaBrhux_C8RmtWDI_kZSLvdQ 1๊ต์ JSON ๋ค์ด๋ก๋ ์์ ์ด ๋๊ธฐ์ ์ผ๋ก ๊ตฌํ์ด ๋์ด ์๋ค. LOAD ํด๋ฆญ ์ ํ์ด๋จธ๋ฅผ ํฌํจํด ํ๋ฉด ์ ์ฒด๊ฐ ๋ฉ์ถ๊ณ , ๋ค์ด๋ก๋๊ฐ ๋๋๋ฉด ๋ค์ ํ๋ฉด์ด ์์ง์ธ๋ค. ๋น๋๊ธฐ๋ก ๋ง๋ค์ด๋ณด์. ๋น๋๊ธฐ๋? : ํ์ฌ ์ค๋ ๋์์ ์์ ์ ์งํํ๋ฉด์, ๋ค๋ฅธ ์ค๋ ๋๋ฅผ ์ด์ฉํด ๋ค๋ฅธ ์์ ์ ๋์์ ์งํํ๋ ๊ฒ. ๋ค๋ฅธ ์ค๋ ๋์์ ๋น๋๊ธฐ๋ก ์ฒ๋ฆฌํ ์์ ์ด ์๋ฃ๋๋ฉด, ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ์์์ผ ํ๋ค. DispatchQueue.global().async { ... } ์ด๋ ๊ฒ ์ฒ๋ฆฌํ๋ฉด ํ๋ก๊ทธ๋จ์ด ์ฃฝ๋๋ค. UI๋ฅผ ๊ฑด๋๋ฆฌ๋ ๋ถ๋ถ์ global()์ค๋ ๋๊ฐ ์๋ ..
Customizing the appearance of UINavigationBar UINavigationBar๋ scrollEdgeAppearance์ ํ์ฅ์ด๋ค. ๊ธฐ๋ณธ์ ์ผ๋ก ๋ชจ๋ ๋ด๋น๊ฒ์ด์ ๋ฐ์ ํฌ๋ช ํ ๋ฐฐ๊ฒฝ์ ์ ๊ณตํ๋ค. UINavigationBarAppearance ํด๋์ค๋ UINavigation์ ์ธํ ์ค์ ํด๋์ค์ด๋ค. ๋ด๋น๊ฒ์ด์ ๋ฐ์ ์์์ด๋ ๋ด์ฉ ์์์ ๋ฐ๊พธ๊ณ ์ถ์ ๋ ์ฌ์ฉ ๊ฐ๋ฅ ๋ด์ฉ์ด ์คํฌ๋กค๋๋ ๋ทฐ์ปจํธ๋กค๋ฌ์์๋ standardAppearance์ scrollEdgeAppearance๋ฅผ UINavigationBar์ ํจ๊ป ์ ์ฉ์์ผ์ผ ํ๋ค AppDelegate์ ์๋์ ๊ฐ์ด ๋ฉ์๋์ ์ฝ๋๋ฅผ ์ถ๊ฐํ๋ค. AppDelegate.swift import UIKit @main class AppDelegate: ..
์ฐธ๊ณ ํ ๊ณต์ ๋ฌธ์ : https://developer.apple.com/documentation/uikit/views_and_controls/table_views/asynchronously_loading_images_into_table_and_collection_views ํด์ : ๋น๋๊ธฐ์ ์ผ๋ก ํ ์ด๋ธ๋ทฐ, ์ปฌ๋ ์ ๋ทฐ์ ์ด๋ฏธ์ง ๋ก๋ํ๊ธฐ Asynchronously Loading Images into Table and Collection Views UICollectionView๋ฅผ ๊ตฌํํ๋ฉฐ ์ ๋ง๋ค ์ด๋ฏธ์ง๋ฅผ API์์ ๋ฐ์์ค๋ ์์ ์ ํ๋ค. ์คํฌ๋กค์ด ๋ ๋๋ง๋ค ๊ฐ์ ์ด๋ฏธ์ง๋ฅผ ๋ฐ๋ณตํด์ ์์ฒญํด์ผ ํ๋๋ฐ, ์ด ๋ API์ ์ฌ๋ฌ ๋ฒ ๋ฐ๋ณตํด์ ์์ฒญ์ ๋ณด๋ด๊ฒ ๋๋ฏ๋ก ๊ฐ์ ๋์์ ์ฌ๋ฌ ๋ฒ ํ๋ ๋ญ๋น์ด๊ธฐ๋ ํ๊ณ , ์ต์ ์ ๊ฒฝ์ฐ AP..
Asynchronously Loading Images into Table and Collection Views ์๋ฌธ ํ์ธ (์ํ ํ๋ก์ ํธ ๋ค์ด๋ก๋ ๋งํฌ ํฌํจ) https://developer.apple.com/documentation/uikit/views_and_controls/table_views/asynchronously_loading_images_into_table_and_collection_views ๊ฐ์ ์ด๋ฏธ์ง ์บ์ฑ์ ๋น์ ์ ์ฑ์ ํ ์ด๋ธ๋ทฐ์ ์ปฌ๋ ์ ๋ทฐ๊ฐ ์ธ์คํด์ค๋ฅผ ๋น ๋ฅด๊ฒ ๋ง๋ค๊ณ ์คํฌ๋กค์ ๋น ๋ฅด๊ฒ ์๋ตํ๋๋ก ๋์์ค๋๋ค. ์ํ ํ๋ก์ ํธ์ ์ฑ์ URL์ ํตํด ์ด๋ฏธ์ง๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ์ ์์ฐํฉ๋๋ค. ์ด๋ฏธ์ง๋ค์ assets catalog์ ์ผ๋ถ๊ฐ ์๋, URL์ ํตํด ๋น๋๊ธฐ์ ์ผ๋ก ๊ฐ๊ฐ ๋ก๋ฉ์ ์๋ฎฌ๋ ์ด์ ํ๊ธฐ ์ํ..
UILabel ํ ์คํธ์ ์ผ๋ถ ํฐํธ/์์/ํฌ๊ธฐ ๋ณ๊ฒฝํ๊ธฐ, ์ทจ์์ ๊ธ๊ธฐ - attributedText, NSMutableAttributedString https://ios-development.tistory.com/654 https://zeddios.tistory.com/300 NSMutableAttributedString(string:) ๊ณผ .addAttribute(_:value:range:)์ ๊ฐ๋ ์ ์ดํดํ๋ ๊ฒ ์ค์ํ๋ค. ํ์๋๋ก UILabel์ ๋ง๋ค๊ณ ํ ์คํธ ๊ฐ์ ๋ฃ๋๋ค ํจ์ (์ฌ๊ธฐ์๋ setMenuLabelAttribute())๋ฅผ ๋ง๋ ๋ค menuLabel.text๋ฅผ ๊ฐ์ ธ์ค๊ณ (fullText) fullText๋ฅผ NSString์ผ๋ก ํ๋ณํํ๋ค ์๋ ๋จ๊ณ์์ ๋ฒ์๋ฅผ ๊ฐ์ ธ์ค๊ธฐ ์ํด String->NSSt..
์ฝ๋๋ก UICollectionView ๋ง๋ค๊ธฐ 1. ์ปฌ๋ ์ ๋ทฐ์ ์ ์ญํ ์ ํ UICollectionViewCell์ ๋ง๋ค๊ณ ๋ด์ฉ ๋ฃ๊ธฐ import UIKit class HomeYourRecommandViewCell: UICollectionViewCell { static let identifier = "HomeYourRecommandViewCell" private let menuImageViewSize: CGFloat = 100 private let menuImageView: UIImageView = { var imageView = UIImageView() imageView.backgroundColor = .cyan imageView.layer.cornerRadius = 50 return imageView ..
import UIKit class AnyView: UIView { static let identifier = "AnyView" private let anyLabel: UILabel = { var label = UILabel() return label }() override init(frame: CGRect) { super.init(frame: frame) setUI() setConstraint() } required init?(coder: NSCoder) { super.init(coder: coder) setUI() setConstraint() } private func setUI() { self.addSubview(anyLabel) } private func setConstraint() { // set..