ios - UITesting 如何获取属于 tabBar 部分的数字?

标签 ios swift user-interface

对标题感到抱歉,真的不知道如何表达这个问题。这里有一张图片可以提供帮助:enter image description here

我希望能够将“通知”选项卡旁边的数字“5”放入一个变量中,并且正在努力做到这一点。 “通知”选项卡就是这个按钮

XCUIApplication().tabBars.buttons["Notifications"]

最佳答案

每个 UITabBarItem 都有一个 badgeValue

tabBarController?.tabBar.items?[3].badgeValue 

关于ios - UITesting 如何获取属于 tabBar 部分的数字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37757753/

相关文章:

java - 记住 swing 中的窗口位置

ios - 如何在 Swift 中暂时停止使用某个方法?

iphone - TableView 在 Swift 中推送到详细 View

ios - CoreData 对象在实体之间移动不起作用

java - 使用相关任务更新 GUI

ios - UIImageView的图层边框可见内嵌

ios - 如何在 Swift 中使用 UIImageView 设置背景图片

ios - 使用 calendarWithIdentifier 返回单个日历

ios - UIPasteboard包含图像并将文本粘贴到Mail中

java - 将 Slick2D 游戏放入 GUI 中