如何向生成的系统添加徽章“更多” UITabBarItem [英] How to add a badge to the system generated "More" UITabBarItem

查看:98
本文介绍了如何向生成的系统添加徽章“更多” UITabBarItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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)

我不知道如何访问自UITabBar中的items数组以来,More项只包含我创建的6个实际UITabBarItem;它不包括系统生成的更多项。我已经尝试在其中一个隐藏的UITabBarItem上设置徽章,但没有显示任何徽章。

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.

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

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.)

推荐答案

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

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";

这篇关于如何向生成的系统添加徽章“更多” UITabBarItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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