如何在 SwiftUI 2.0 中管理 Tab bar 徽章计数? [英] How to manage Tab bar badge count in SwiftUI 2.0?
问题描述
这里我使用 SwiftUI 2.0 并管理 TabBar 徽章计数.参考
当键盘出现时如何管理这个徽章数量?
尝试将 .ignoresSafeArea(.keyboard) 添加到 GeometryReader 和/或包含 ZStack 的徽章.
您的视图正在调整大小以避免键盘,这是 iOS 14 中的新默认设置.使用新的 .ignoresSafeArea(.keyboard) 修饰符禁用该行为.
Here I have use SwiftUI 2.0 and manage TabBar badge count. Reference of
https://medium.com/flawless-app-stories/swiftui-tutorial-showing-badge-on-tab-bar-item-d71e4075b67a
In Xcode 12.1 , the badge gets pushed up when the keyboard appears
How to mange this badge count When keyboard appear ?
Try adding .ignoresSafeArea(.keyboard) to your GeometryReader and/or the badge’s containing ZStack.
Your view is resizing to avoid the keyboard, which is the new default in iOS 14. Use the new .ignoresSafeArea(.keyboard) modifier to disable that behavior.
这篇关于如何在 SwiftUI 2.0 中管理 Tab bar 徽章计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!