如何在 SwiftUI 2.0 中管理 Tab bar 徽章计数? [英] How to manage Tab bar badge count in SwiftUI 2.0?

查看:22
本文介绍了如何在 SwiftUI 2.0 中管理 Tab bar 徽章计数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里我使用 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆