Closed yFeii closed 5 years ago
if ([hasRedTip boolValue]) {
CYLTabBarController *tabbarC = RootTabBarController;
UIViewController *vc = tabbarC.viewControllers[2];
vc.tabBarItem.badgeValue = @" ";
// UIView *tabBadgePointView1 = [UIView cyl_tabBadgePointViewWithClolor:UIColorHexMake(@"#FF0937") radius:4.5];
// @try {
// [tabbarC.viewControllers[2] cyl_setTabBadgePointView:tabBadgePointView1];
// [tabbarC.viewControllers[2] cyl_showTabBadgePoint];
//
// } @catch (NSException *exception) {}
}
使用系统badge 则不会出现
我复现了: 应该是设置小红点的方法导致的问题。 目前推测原因是: 调用 cyl_popSelectTabBarChildViewControllerAtIndex 后,会执行会执行 setSelectedIndex 和 popToRootViewControllerAnimated:NO,还有小红点导致的布局更新, 导致动画卡顿。
比如我像下面这样实现cyl_popSelectTabBarChildViewControllerAtIndex方法,就可避免黑条出现,但是 随着delaySeconds的减少,可能出现tabbar消失的问题。 且popToRootViewControllerAnimated:YES,动画属性必须是YES。
- (UIViewController *)cyl_popSelectTabBarChildViewControllerAtIndex:(NSUInteger)index {
UIViewController *viewController = [self cyl_getViewControllerInsteadOfNavigationController];
[viewController checkTabBarChildControllerValidityAtIndex:index];
NSUInteger delaySeconds = 0.8;
CYLTabBarController *tabBarController = [self cyl_tabBarController];
[self.navigationController popToRootViewControllerAnimated:YES];
dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delaySeconds * NSEC_PER_SEC));
dispatch_after(when, dispatch_get_main_queue(), ^{
tabBarController.selectedIndex = index;
});
UIViewController *selectedTabBarChildViewController = tabBarController.selectedViewController;
UIViewController *fromViewController = [selectedTabBarChildViewController cyl_getViewControllerInsteadOfNavigationController];
return fromViewController;
}
故小红点实现内部有问题,所以目前建议不同时使用标题里我提到的两个API方法。后期我打算更新下小红点的实现,现在的实现方法,引入了较多bug。
v1.19.0更改小红点实现方式,解决了该问题,并增加多个API自定义红点UI样式、动画效果。请更新重试。
好的
Base Info for this issue
在tabbar=2的列表push->详情。在详情页调 cyl_popSelectTabBarChildViewControllerAtIndex 时出现黑条
1. How to repeat the problem.
在tabbar=2的列表push->详情。在详情页调 cyl_popSelectTabBarChildViewControllerAtIndex 时出现黑条 图在这 https://i.loli.net/2018/09/05/5b8f61e63eff7.png