如何在iPhone的标签栏中设置badgevalue? [英] how to set the badgevalue in tabbar in iphone?

查看:64
本文介绍了如何在iPhone的标签栏中设置badgevalue?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码在当前标签栏中设置badgevalue,但在标签栏中不可见

I am using the following code to set the badgevalue in current tab bar but its not visible in tab bar

self.navigationController.tabBarItem.badgeValue = @"1"

将徽章值放在标签栏中的正确方法是什么.

what is the correct way of putting the badge value in the tab bar.

推荐答案

您是否知道为什么此self.navigationController.tabBarItem.badgeValue = @"1"无效?我遇到了同样的问题,但不知道为什么.
但这是这样的:

Did you figure out why this self.navigationController.tabBarItem.badgeValue = @"1" didn't work? I got the same problem but didn't know why.
But this way it works:

[[[[self tabBarController] tabBar] items] objectAtIndex:0] setBadgeValue:@"AB"];

这篇关于如何在iPhone的标签栏中设置badgevalue?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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