我无法在 iOS 7.1 中修改 UItabBarItem 的徽章颜色,所以我只是向 TabBar 添加了一个 UILabel 并设置了我想要的颜色并使其在 iOS 7.1 中工作。但我不确定这是否是正确的做法。我将提交我的应用程序到应用商店。如果我的应用程序有可能因此被拒绝,有人可以指导我吗?下面是我的代码。

UILabel *badge=[[UILabel alloc]init];
badge.text = @"2";
badge.textAlignment=NSTextAlignmentCenter;
badge.frame=CGRectMake(122, 1, 20, 20);
badge.layer.cornerRadius=10;
badge.textColor=[UIColor whiteColor];
badge.backgroundColor=[UIColor greenColor];
[tabbar addSubview:badge];

最佳答案

您无法修改徽章的颜色,因为它尚未向用户公开。您只能将文本设置为字符串

@property(nonatomic,copy) NSString *badgeValue;    // default is nil

你所做的一切都很好。

关于ios - 更改 iOS 7.1 中的 UITabBarItem 徽章颜色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23039136/

10-09 04:26