如何向系统生成的“更多”添加徽章UITabBarItem

发布于 2024-08-23 22:51:17 字数 482 浏览 3 评论 0原文

我的应用程序有 6 个菜单项,因此操作系统显示前 4 个菜单项,然后显示一个链接到屏幕的“更多”项,用户可以在其中选择其他两个菜单项。

我的问题是,我想在“更多”项上显示一个徽章,以便用户知道隐藏的菜单项之一需要他们的注意。 (我们的用户很清楚徽章代表哪个隐藏项目,因为其中一个隐藏项目是“设置”,另一个是当前上传)

我不知道如何访问“更多”项目,因为 UITabBar 上的“项目”数组仅包含我创建的 6 个实际 UITabBarItems;它不包括系统生成的“更多”项目。我尝试在隐藏的 UITabBarItems 之一上设置徽章,但从未显示任何徽章。

我在谷歌上没有找到太多信息,这让我怀疑我的做法是否完全错误。当您下载项目时,iTunes 应用程序会执行相同的操作。他们展示了一个“更多”项目,并在上面附上了一个徽章,所以我认为我是一个很好的伙伴,但如果我看到他们是如何做到的,我会被诅咒的。 (除非他们手动创建 UITabBarSystemItemMore 项并手动处理显示其他菜单项。呃。)

My app has 6 menu items, so the OS shows the first 4, then shows a "More" item that links to a screen where the user can select the other two.

My problem is that I want to show a badge on the More item so that the user knows that one of the menu items that is hidden needs their attention. (It's clear to our users which hidden item the badge represents since one of the hidden items is Settings and the other is current Uploads)

I don't know how to access the "More" item since the "items" array on UITabBar only contains the 6 actual UITabBarItems that I've created; it doesn't include the system generated "More" item. I've tried setting the badge on one of the hidden UITabBarItems, but no badge is ever displayed.

I didn't find much on Google, which makes me wonder if I'm going about this completely wrong. The iTunes app does the same thing when you download items. They display a More item and attach a badge to it, so I figured I was in good company, but I'll be damned if I see how they did that. (Unless they manually created a UITabBarSystemItemMore item and manually handled displaying the other menu items. Ugh.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦开始←不甜 2024-08-30 22:51:17

实际上,您可以修改标签栏控制器的“更多导航控制器”的标签栏项目。如果你的标签栏控制器是“tabBarController”,你可以这样做。

UITabBarItem *item = [tabBarController moreNavigationController].tabBarItem; 
item.badgeValue = @"100";

Actually you can modify the tab bar item of the "more navigation controller" of your tab bar controller. If your tab bar controller is "tabBarController", you can do it this way.

UITabBarItem *item = [tabBarController moreNavigationController].tabBarItem; 
item.badgeValue = @"100";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文