티스토리 뷰
Image를 어떻게 사용하는지 알아보자
import SwiftUI
struct CircleImageView: View {
var body: some View {
Image("profile")
// 사이즈 조절
.resizable()
// 비율 조절
.scaledToFit()
// .aspectRatio(contentMode: .fill)
// 크기 조절
.frame(width: 300, height: 300)
// 이미지 자르기
// .clipped()
.clipShape(Circle())
// 그림자
.shadow(color: .gray, radius: 2, x: 5, y: 10)
// Overlay
.overlay(Circle().stroke(Color.red, lineWidth: 4)) // 라운드
.overlay(Circle().foregroundColor(.black.opacity(0.3))) // 반투명
.overlay( // 글자
Text("Harry")
.foregroundColor(.white)
.font(.system(size: 30))
.fontWeight(.bold)
)
}
}
🤔
Text에 대해 알아볼 때도 느꼈지만 코드 한줄로 손쉽게 UI를 구성할 수 있는 것은 확실히 편한 것 같다.
'iOS > SwiftUI' 카테고리의 다른 글
[SwiftUI] 화면전환 (0) | 2022.04.28 |
---|---|
[SwiftUI] Stack (0) | 2022.04.24 |
[SwiftUI] Text (0) | 2022.04.24 |
[SwiftUI] WebView (0) | 2022.04.24 |
[SwiftUI] ObservedObject, Published (0) | 2022.04.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Protocol
- enumerations
- navigation
- kakao
- 의미있는이름
- file private
- 곰튀김
- strcut
- 카메라
- Custom
- MVVM
- rxswift
- Git
- Swift
- OCR
- ObservedObject
- frame과 bounds 차이
- tabview
- AWS Fargate
- delegate
- CodingTest
- Login
- IOS
- ChatGPT
- Generic
- Xcode
- onTapGesture
- SwiftUI
- docker
- AWS
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함