티스토리 뷰
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
import SwiftUI
struct ContentView: View {
init(){
let myAppearance = UINavigationBarAppearance()
myAppearance.titleTextAttributes = [.foregroundColor : UIColor.blue, .font : UIFont.italicSystemFont(ofSize: 30)]
myAppearance.largeTitleTextAttributes = [.foregroundColor : UIColor.purple]
myAppearance.backgroundColor = UIColor.orange
UINavigationBar.appearance().standardAppearance = myAppearance
UINavigationBar.appearance().tintColor = UIColor.black
}
var body: some View {
NavigationView{
List{
NavigationLink(
destination: Text("Destination"),
label: {
HStack{
Image(systemName: "person")
Text("Navigate")
}
})
Text("Hi")
Text("Hi")
}
.navigationBarTitle("Hello", displayMode: .large)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
|
cs |
- init() 에서 navigationView의 UI 꾸밈.
- UiNavigationBarAppearance()
: titleTextAttributes(상단 Bar text 설정), largeTitleTextAttributes(Title 설정), backgroundColor(상단 Bar background 설정)
- tintColor는 destination화면의 상단 Bar 글씨 색 설정
- navigationLink 로 화면 이동 구현.
- 28행의 .navigationBarTitle 에서 title과 모드를 정할 수 있음. (.large 와 .inline)
'iOS 개발 > SwiftUI' 카테고리의 다른 글
SwiftUI) Toggle Custom 예제 (0) | 2022.01.30 |
---|---|
SwiftUI) TabView 사용 예제 (0) | 2022.01.29 |
SwiftUI) placeholder 사용 예제 (0) | 2022.01.28 |
SwiftUI) Grid 사용 예제 (0) | 2022.01.28 |
SwiftUI) WebView 사용하기 예제 - UIKit으로 만든 웹뷰 가져오기 예제 (0) | 2022.01.28 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- BFS
- 여행경로
- 이분탐색
- 의존관계역전법칙
- 생명 주기
- XCFramework
- XcodeBuildSystem
- 학교 과제
- 클린 코드
- ios simulator
- 면접질문
- 알고리즘
- dfs
- 프로그래머스
- 순환참조
- 단어변환
- clean code 정리
- clean code
- ios
- 클린 코드 정리
- 메모리 순환참조
- 주입
- 의존성
- 클린 코드 줄거리
- swiftc
- 링커
- CLANG
- SwiftUI
- Swift
- 전처리기
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함