jkpang / PPBadgeView

iOS Custom Badge, Support UIView, UITabBarItem, UIBarButtonItem ,Support Objective-C/Swift; iOS自定义Badge组件, 支持UIView, UITabBarItem, UIBarButtonItem, 支持Objective-C/Swift
MIT License
848 stars 119 forks source link

tabbar #37

Open KenwayCen opened 5 years ago

KenwayCen commented 5 years ago

tabbarItem 的角标不显示 你的qq群根本加不了

jkpang commented 5 years ago

角标不显示看看是否已获取到了tabbarItem实例?QQ群已满,只能出,不能进 @KenwayCen

Hank-Zhong commented 5 years ago

假设TabBar有2个界面,在第二个界面(VC2)还未展示的时候,在自定义TabBarController里直接调用[VC2.tabBarItem pp_addBadgeWithText:@"9+"]无效,VC2.tabBarItem是有值的, UIView *tabBarButton = [self valueForKey:@"_view"];获取不到tabBarButton, 请问此时应该如何解决? @jkpang

Hank-Zhong commented 5 years ago

假设TabBar有2个界面,在第二个界面(VC2)还未展示的时候,在自定义TabBarController里直接调用[VC2.tabBarItem pp_addBadgeWithText:@"9+"]无效,VC2.tabBarItem是有值的, UIView *tabBarButton = [self valueForKey:@"_view"];获取不到tabBarButton, 请问此时应该如何解决? @jkpang

目前我的解决办法是在自定义的TabBarController里: -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; // 提前加载,让其调用viewdidload展示未读消息数 [self.msgVC loadViewIfNeeded]; }