iOS 설정의 “손쉬운 사용 → 버튼 사용”을 설정했을 때,
SwiftUI 의 기본 버튼 스타일을 사용하면 회색 배경이 생기는 문제가 발생합니다.
"손쉬운 사용" 설정을 해도 기본 버튼 스타일이 그대로 있길 원한다면 아래처럼 커스텀 버튼 스타일을 지정해주어야 합니다.
struct BasicButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.opacity(configuartion.isPressed ? 0.3 : 1)
.animation(configuartion.isPressed ? .none : .easeInOut(duration: 0.15), value: configuartion.isPressed)
}
}
struct CustomView: View {
var body: some View {
Button {
// tab event handle
} label: {
Text("버튼");
}.buttonStyle(BasicButtonStyle())
}
}
'iOS > SwiftUI' 카테고리의 다른 글
[SwiftUI] Custom Calendar 기능 만들어보기 - 1 (0) | 2022.04.08 |
---|---|
[SwiftUI] 프로그래머스 과제관 (K-MOOC 강좌정보 서비스) (0) | 2022.04.06 |
[SwiftUI] NavigationLink 버그 (2) | 2022.02.23 |
[SwiftUI] Naver Map에 Custom Marker 띄우기 (2) | 2022.02.16 |
[SwiftUI] Custom Navigation Bar의 Back Swipe 액션 활성화하기 (2) | 2022.02.15 |