swift - Swift/Xcode 标签栏徽章刷新
问题描述
代码片段:
self.tabBarController?.tabBar.items?[2].badgeValue = "999"
上面的代码有效,但我的标签栏徽章仅在我滚动(与)视图时更新。有什么想法吗?
每当我从购物袋中添加或删除商品时,都会更新 badgeValue。这个函数在 Bag 类中:
func adicionarProduto(idProduto : Int){
produtos.append(idProduto) self.tabBarController?.tabBar.items?[2].badgeValue = String(sacola.produtos.count)
}
谢谢!
解决方案
推荐阅读
- primefaces - 尽管在 primefaces p:cellEditor 中具有相同的表达式,但 h:outputText 中的 JSF2 ValueExpression 不会评估为 true
- sql-server - 如何将二进制列数据读入火花数据帧?
- c# - 将 retryPolicy 与 SqlAzureExecutionStrategy 一起使用时,避免“SqlParameter 已被另一个 SqlParameterCollection 包含”异常
- mysql - 带有'n'个条件的Mysql查询用NOT括起来
- arrays - 在 Tableview (Swaft) 上获取重复的 Firestore 文档
- typescript - TypeScript 的 Visual Studio Code 自动导入行为不一致
- azure - 增加 Kubernetes 中状态集的 PVC 大小
- amazon-web-services - 如果key为空,则只允许一个ApiMapping
- javascript - 如何在单击复选框上显示多个 div
- linux - 如何设置电源按钮行为以关闭 linux 中的显示?