네비게이션바 코드 설정
SceneDelegate.swift
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let naviVC = UINavigationController(rootViewController: ViewController())
window?.rootViewController = naviVC
window?.makeKeyAndVisible()
}
ViewController.swift
func setupNaviBar() {
title = "메모장"
// 네비게이션바 설정관련
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground() // 불투명
appearance.backgroundColor = .white
navigationController?.navigationBar.tintColor = .systemBlue
navigationController?.navigationBar.standardAppearance = appearance
navigationController?.navigationBar.compactAppearance = appearance
navigationController?.navigationBar.scrollEdgeAppearance = appearance
// 네비게이션 아이템(오른쪽)
self.navigationItem.rightBarButtonItem = self.plusButton
}
'PROGRAMMING CODE > SWIFT' 카테고리의 다른 글
[UIkit] 갤러리에서 사진 선택하기, 화면 요소 제스쳐 이벤트처리(PhotosUI, PHPicker) (0) | 2023.12.12 |
---|---|
[UIKit] TextView placeholder 구현 (0) | 2023.12.12 |
[UIkit] Tap bar (storyboard) (0) | 2023.12.01 |
[UIkit] Navigation Bar (storyboard) (0) | 2023.12.01 |
[Xcode] Tuist 적용 연습 (1) | 2023.11.24 |