简体   繁体   English

Swift 防止 TabBar 在键盘处于活动状态时向上移动

[英]Swift prevent TabBar from moving up when Keyboard is active

so whenever My Keyboard toggles the Tabbar moves up with it like shown in the image.所以每当我的键盘切换时,Tabbar 就会像图像中显示的那样向上移动。 Is there a way to prevent this when the Keyboard is active?当键盘处于活动状态时,有没有办法防止这种情况? My version is iOS 14 and XCode 12 Thanks in advance!我的版本是 iOS 14 和 XCode 12 提前致谢!

/// Corretion: How can I modify any View in SwiftUI to prevent moving up when the Keyboard shows up? /// 更正:如何在 SwiftUI 中修改任何视图以防止在键盘出现时向上移动?

struct SwiftUIView: View {
@State var text = ""
var body: some View {
        VStack{
        TextField("Text", text: $text)
            Text(">>Don't Move Me Up When Keyboard Is Active<<")
    }
}

} }

Paul保罗

simulator view when tabbar moves up when keyboard is active当键盘处于活动状态时标签栏向上移动时的模拟器视图

尝试将以下修饰符添加到您的标签栏:

.ignoresSafeArea(.keyboard, edges: .bottom)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当视图已经显示时如何防止键盘向上移动视图 - How to prevent keyboard from moving the view up when it is already shown 当使用带有多个文本字段的键盘时,如何防止视图向上移动多余的空间 - How to prevent view from moving up extra space when using keyboard with multiple text fields 防止表格视图页脚与键盘一起向上移动 - Prevent the table view footer from moving up along with the keyboard 如何防止的UITextView从键盘秀动起来 - How to prevent UITextView from moving up on keyboard show 出现键盘时移动文本框覆盖了(Swift)中的顶部文本框 - Moving textfield when keyboard appears is covering up top textfields in (Swift) 当键盘将其快速隐藏时,TableView单元中的TextView不会向上移动 - TextView in TableView cell not moving up when keyboard hide it in swift 当键盘出现Swift时,使用textfield和Button向上查看 - moving View up with textfield and Button when keyboard appear Swift Swift UITableViewTable页脚通过键盘向上移动 - Swift UITableViewTable Footer moving up with keyboard 使用键盘将UITextField向上移动-Swift 4.2中的更改吗? - Moving UITextField up with keyboard - changes in swift 4.2? 如何防止键盘启动时表格视图不选择单元格 - How to prevent table view from not selecting the cell when keyboard is up
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM