-
반응형
SwiftUI 를 사용하다보면 뭐가 자동으로 샥샥 되는것이 편하게 느껴지다가도, 어느순간 원하지 않는 동작 때문에 삽질하는 케이스가 자꾸 생긴다. 휴 .. 이번에도 iOS 14 부터 SwiftUI가 자동으로 지원하는 keyboard avoidance 기능을 Disable 하려다가 삽질 한 것을 기록합니다.
원래는 아래 modifier를 적용하면 keyboard avoidance가 disable된다고 문서에 적혀있는데 동작하지 않음 .. 애플넘들 .. (iOS 14 only)
.ignoresSafeArea(.keyboard, edges: .bottom)
그래서 삽질삽질 하다가 아래 stackOverFlow 글 보고 따라했다가 해결했습니다.
https://stackoverflow.com/a/66006235/3746837
iOS 14 SwiftUI Keyboard lifts view automatically
I am using TextField in my view and when it becomes the first responder, it lefts the view as shown in the below GIF. Is there any way I can get rid of this behavior? Here is my code NavigationView(
stackoverflow.com
GeometryReader { _ in VStack { TextField("Type something...", text: $title) } .frame(height: 100) .padding(.top, UIApplication.shared.windows[0].safeAreaInsets.top) .ignoresSafeArea(.keyboard, edges: .bottom) }
그런데 테스트하다보면 아래 modifier 안 적어도 동작한다. 결국 아무 기능이 없는 넘이었나 🤔
.ignoresSafeArea(.keyboard, edges: .bottom)
반응형'개발' 카테고리의 다른 글
Mac 오디오 지직 거릴때 (0) 2021.07.14 [iOS/ Swift] SwiftLint & SwiftFormat 적용하기 (0) 2021.06.13 [Fastlane] 인증서 싱크 오류 해결 (nuke) (0) 2021.05.08 [iOS/Swift] Universal link 적용하기 (2) 2021.04.24 Fastlane 을 사용해서 Firebase Distribution 배포하기 (0) 2021.04.17 댓글