일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 프로그래머스
- 독학
- c++
- SQLD
- 독일어
- BFS
- 부주상골수술
- 구현
- 코테
- 카카오인턴
- 카카오코테
- 카카오인턴십
- 코딩테스트
- 부주상골수술후기
- dp
- DFS
- 세브란스
- ChatGPT
- 백준
- 부주상골
- 부주상골증후군
- 스택
- istringstream
- 리눅스
- SWIFT
- 롯데정보통신
- 독일어독학
- 분할정복
- sql
- IOS
Archives
- Today
- Total
슈뢰딩거의 고등어
(10일차) 14일 만에 IOS 앱 끝내기 챌린지 : SwiftUI 버튼 본문
https://www.youtube.com/watch?v=Xx9HjAB-Zz0


버튼을 눌렀을때 반응하는 것을 알 수 있다.
//
// ContentView.swift
// test project
//
// Created by jhmin on 2023/03/01.
//
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
// Button instance with closure
Button("Click me", action: {
print("Hello world")
})
// Button instance with trailing closure
Button("Click me") {
print("Hello world")
}
// Button instance with lable view
Button(action: {
print("Hello world")
}, label: {
HStack{
Image(systemName: "pencil") // sf-symbol
Text("Edit")
}
})
}
}
}
// Only for previews
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

//
// ContentView.swift
// war challenge
//
// Created by jhmin on 2023/02/26.
//
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack {
Image("background").ignoresSafeArea()
VStack {
Spacer()
Image("logo")
Spacer()
HStack {
Spacer()
Image("card3")
Spacer()
Image("card4")
Spacer()
}
Spacer()
// Change Image into Button
Button(action: {}, label: {
Image("dealbutton")
})
Spacer()
HStack {
Spacer()
VStack {
Text("Player")
.font(.headline)
.foregroundColor(Color.white)
.padding(.bottom, 10.0)
Text("0")
.font(.largeTitle)
.padding()
.fontWeight(.bold)
.foregroundColor(Color.white)
}
Spacer()
VStack {
Text("CPU")
.font(.headline)
.foregroundColor(Color.white)
.padding(.bottom, 10.0)
Text("0")
.font(.largeTitle)
.padding()
.fontWeight(.bold)
.foregroundColor(Color.white)
}
Spacer()
}
Spacer()
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
'14일만에 IOS 앱 끝내기 챌린지' 카테고리의 다른 글
(13일차, 14일차) 14일 만에 IOS 앱 끝내기 챌린지 : 슬롯머신 만들기 (0) | 2023.03.04 |
---|---|
(11일차, 12일차) 14일 만에 IOS 앱 끝내기 챌린지 : State Properties, If 조건문 (0) | 2023.03.04 |
(8일차, 9일차) 14일 만에 IOS 앱 끝내기 챌린지 - Swift 프로그래밍 : 구조체, 객체 (0) | 2023.03.01 |
(3,4,5 일차) 14일 만에 IOS 앱 끝내기 챌린지 - UI 만들기 (0) | 2023.02.26 |
(6일차, 7일차) 14일 만에 IOS 앱 끝내기 챌린지 - Swift 프로그래밍 : 변수/상수, 함수 (1) | 2023.02.26 |