Closed meilbn closed 5 years ago
收到,今天发布版本修复下。
感谢,我现在也在尝试修改源码,但是出现别的问题。再试试自己项目里面修改下是否能避免。期待新版本。
微博@iOS程序犭袁 notifications@github.com 于2019年5月29日周三 下午8:34写道:
收到,今天发布版本修复下。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ChenYilong/CYLTabBarController/issues/378?email_source=notifications&email_token=AAZW24YYEN7UVHHLAU3CQULPXZZ7FA5CNFSM4HQL3FTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWPFWXA#issuecomment-496917340, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZW242KJHD5IQHF4K7NRXTPXZZ7FANCNFSM4HQL3FTA .
无需修改源码,我看了下你的demo,你的写法有问题,添加如下的代码既可,Lottie也考虑到的该场景,已经尝试可以满足你的需求。
#pragma mark - UITabBarControllerDelegate
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
BOOL should = ![((CYLBaseNavigationController *)viewController).topViewController isKindOfClass:[MineViewController class]];
//缺少了下面这一行的代码,如下代码用来同步是否选中的状态。
[[self cyl_tabBarController] updateSelectionStatusIfNeededForTabBarController:tabBarController shouldSelectViewController:viewController shouldSelect:should];
return should;
}
参考:https://github.com/ChenYilong/CYLTabBarController/issues/259
感谢,看来是我没仔细看头文件,这样写的确可以的。👍
微博@iOS程序犭袁 notifications@github.com 于2019年5月30日周四 上午3:53写道:
我看了下你的demo,你的写法有问题,添加如下的代码既可,Lottie也考虑到的该场景,已经尝试可以满足你的需求。
pragma mark - UITabBarControllerDelegate
(BOOL)tabBarController:(UITabBarController )tabBarController shouldSelectViewController:(UIViewController )viewController {
BOOL should = ![((CYLBaseNavigationController *)viewController).topViewController isKindOfClass:[MineViewController class]]; //缺少了下面这一行的代码,如下代码用来同步是否选中的状态。
[[self cyl_tabBarController] updateSelectionStatusIfNeededForTabBarController:tabBarController shouldSelectViewController:viewController shouldSelect:should];
return should;
}
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ChenYilong/CYLTabBarController/issues/378?email_source=notifications&email_token=AAZW24ZIBBAR2MBDVCPIUFLPX3NLNA5CNFSM4HQL3FTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWQOWAQ#issuecomment-497085186, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZW24447HA6YXT664GFRSTPX3NLNANCNFSM4HQL3FTA .
现在发现一个新的问题,字典中都设置了 CYLTabBarLottieSize(如 24),但是第一个 tabBarItem 的 lottie 图片大小还是 22,第二个大小是指定的。
我用你的demo试了试,40大小,都可以设置成功。你看下:
+ (NSArray<NSDictionary *> *)tabBarItemsAttributesForController {
return @[@{
CYLTabBarItemTitle : @"Discover",
CYLTabBarLottieURL : [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"discover" ofType:@"json"]],
CYLTabBarLottieSize : [NSValue valueWithCGSize:CGSizeMake(40, 40)],
},
@{
CYLTabBarItemTitle : @"Mine",
CYLTabBarLottieURL : [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"mine" ofType:@"json"]],
CYLTabBarLottieSize : [NSValue valueWithCGSize:CGSizeMake(40, 40)],
}];
}
真奇怪,公司项目里面第一个就是没成功的,Demo 里面是可以的。 抱歉,我自己再看看,不是库的问题。。。
Base Info for this issue
1. How to reproduce the problem.
在可以延迟登录的 App 里面,点击某些操作,或者,像点击底部 TabBar 中的“我的”的时候,要求用户登录,这样的话,
UITabBarControllerDelegate
的- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
方法会判断是否已登录,没有登录的话,就会弹出登录界面,这个方法返回 NO,但是如下图所以,Lottie 动画还是会执行,但是标签页并没有选中“我的”。2. Please help me in this way.
如果
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
方法返回 NO,Lottie 动画并不执行。3. Here is a Demo.
Demo 已发至邮箱。
4. Here is my Debug log