//
// Tab01.swift
// TabBar_Tutorial
//
// Created by devdepot on 2021/04/28.
//
import SwiftUI
struct tab01: View {
var body: some View{
TabView{
//보여질 화면
MyTab01()
.background(Color.blue)
.tabItem {
Image(systemName: "airplane")
Text("1번")
}
.tag(0)
MyTab02()
.tabItem {
Image(systemName: "flame.fill")
Text("2번")
}
.tag(1)
MyTab03()
.tabItem {
Image(systemName: "doc.fill")
Text("3번")
}
.tag(2)
}
}
}
struct MyTab01: View {
var body: some View{
GeometryReader{ geo in
HStack{
Spacer()
VStack{
Spacer()
Text("1번")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(Color.white)
Spacer()
}
Spacer()
}
}.background(Color.blue)
.edgesIgnoringSafeArea(.all)
}
}
struct MyTab02: View {
var body: some View{
GeometryReader{ geo in
HStack{
Spacer()
VStack{
Spacer()
Text("2번")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(Color.white)
Spacer()
}
Spacer()
}
}.background(Color.orange)
.edgesIgnoringSafeArea(.all)
}
}
struct MyTab03: View {
var body: some View{
GeometryReader{ geo in
HStack{
Spacer()
VStack{
Spacer()
Text("3번")
.font(.largeTitle)
.fontWeight(.bold)
.foregroundColor(Color.white)
Spacer()
}
Spacer()
}
}.background(Color.green)
.edgesIgnoringSafeArea(.all)
}
}
struct tab01_Previews: PreviewProvider {
static var previews: some View {
tab01()
}
}
'IOS > SwiftUI' 카테고리의 다른 글
(SwiftUI)13.TextField (0) | 2021.04.28 |
---|---|
(SwiftUI)12.커스톰 탭뷰 (0) | 2021.04.28 |
(SwiftUI)10.GeometryReader,enum,애니메이션 (0) | 2021.04.28 |
(SwiftUI)09.리스트뷰 (0) | 2021.04.27 |
(SwiftUI)08. 동적 뷰 넣기, 스택 연습,Alert (0) | 2021.04.27 |