1
当我不完全知道它的索引时,如何更新TabBarItem的badgeValue?它可能在“更多”选项卡或主TabBar上,具体取决于用户设置的内容。更新UITabBarItem badgeValue以及更多视图
此外,如果tabbaritem位于“更多”内部,我只能将badgeValue添加到更多项目权限?如何在由SDK自动创建的tableview中的项目本身上添加徽章?
当我不完全知道它的索引时,如何更新TabBarItem的badgeValue?它可能在“更多”选项卡或主TabBar上,具体取决于用户设置的内容。更新UITabBarItem badgeValue以及更多视图
此外,如果tabbaritem位于“更多”内部,我只能将badgeValue添加到更多项目权限?如何在由SDK自动创建的tableview中的项目本身上添加徽章?
是的,你可以,你不必知道指数:
@implementation SomeController
...
-(void)increaseBadgeValue{
NSString *oldVal = self.tabBarItem.badgeValue;
self.tabBarItem.badgeValue = [NSString stringWithFormat:@"%d",[oldVal intValue]+1];
}
....
@end
或者,如果你想这样做的另一个控制器,取代“自我”吧:
anotherController.tabBar.badgeValue ....
如果您的应用中有导航控制器,请执行以下操作:
anotherController.NavigationController.tabBarItem.badgeValue ...