Closed iumiaomiao closed 6 years ago
贴下你设置的代码
- (void)onRCIMReceiveMessage:(RCMessage *)message left:(int)left {
if (message.conversationType == ConversationType_CUSTOMERSERVICE) {
UIViewController *viewController = [self cyl_tabBarController].viewControllers[3];
[viewController cyl_showTabBadgePoint];
}
if (message.conversationType == ConversationType_GROUP) {
UIViewController *viewController = [self cyl_tabBarController].viewControllers[1];
[viewController cyl_showTabBadgePoint];
}
}
你好,我收到融云过来的消息设置红点,发现不起作用,点击到那个tabbaritem后才显示
fixed,请升级到v1.17.0或者以上版本。
这个问题仍然存在,我用的是v1.17.11,当tabbar不在显示区域的时候,使用cyl_showTabBadgePoint方法将无法显示小红点
曲线救国了 `[self.tabBarController setViewDidLayoutSubViewsBlock:^(CYLTabBarController *aTabBarController) {
[aTabBarController.viewControllers[2] cyl_setTabBadgePointView:[UIView cyl_tabBadgePointViewWithClolor:[UIColor CEOrangeColor] radius:4.5]];
if ([CEMessageManager sharedInstance].hasNewMessage) {
[aTabBarController.viewControllers[2] cyl_showTabBadgePoint];
} else {
[aTabBarController.viewControllers[2] cyl_removeTabBadgePoint];
}
//添加提示动画,引导用户点击
// [_WeakSelf addScaleAnimationOnView:aTabBarController.viewControllers[3].cyl_tabButton.cyl_tabImageView repeatCount:20];
}];`
v1.19.1 版本对小红点内部实现做了较大改动,已经能解决该问题了,请更新重试。
另外APP启动后TabBar初始化显示出来,大都有懒加载,会有延迟,建议这样加红点:
//添加小红点
//添加提示动画,引导用户点击
[[self cyl_tabBarController] setViewDidLayoutSubViewsBlockInvokeOnce:YES block:^(CYLTabBarController *tabBarController) {
NSLog(@"🔴类名与方法名:%@(在第%@行),描述:%@", @(__PRETTY_FUNCTION__), @(__LINE__), @"");
if ([self cyl_tabBarController].selectedIndex != 0) {
return;
}
@try {
UIViewController *viewControler0 = tabBarController.viewControllers[0];
NSLog(@"🔴类名与方法名:%@(在第%@行),描述:%@", @(__PRETTY_FUNCTION__), @(__LINE__), viewControler0);
[viewControler0 cyl_showBadge];
[tabBarController.viewControllers[1] cyl_showBadgeValue:@"" animationType:CYLBadgeAnimTypeScale];
[tabBarController.viewControllers[1] cyl_setBadgeBackgroundColor:[UIColor blueColor]];
[tabBarController.viewControllers[2] cyl_showBadgeValue:@"test" animationType:CYLBadgeAnimTypeShake];
[tabBarController.viewControllers[3] cyl_showBadgeValue:@"100" animationType:CYLBadgeAnimTypeBounce];
[tabBarController.viewControllers[4] cyl_showBadgeValue:@"new" animationType:CYLBadgeAnimTypeBreathe];
} @catch (NSException *exception) {}
}];
Base Info for this issue
1. How to repeat the problem.
2. Please help me in this way.
3. Here is a Demo.
4. Here is my Debug log