Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

与 Log in 状态结合决定选中后 Lottie 动画是否执行的问题 #378

Closed
meilbn opened this issue May 29, 2019 · 8 comments
Closed
Labels

Comments

@meilbn
Copy link

meilbn commented May 29, 2019



Base Info for this issue

  1. Version:1.25.0
  2. Language of App :Objective-C
  3. iOS System Version:iOS12
  4. Prototype(是否是真机):YES,模拟器也一样
  5. Issue Type:Q-A

1. How to reproduce the problem.

在可以延迟登录的 App 里面,点击某些操作,或者,像点击底部 TabBar 中的“我的”的时候,要求用户登录,这样的话,UITabBarControllerDelegate- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController 方法会判断是否已登录,没有登录的话,就会弹出登录界面,这个方法返回 NO,但是如下图所以,Lottie 动画还是会执行,但是标签页并没有选中“我的”。

Screenshot 2019-05-29 at 19 26 15

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


@ChenYilong
Copy link
Owner

收到,今天发布版本修复下。

@meilbn
Copy link
Author

meilbn commented May 29, 2019 via email

@ChenYilong
Copy link
Owner

ChenYilong commented May 29, 2019

无需修改源码,我看了下你的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;
}

TabBarDemo-fixed.zip

参考:#259

@meilbn
Copy link
Author

meilbn commented May 30, 2019 via email

@meilbn meilbn closed this as completed May 30, 2019
@meilbn meilbn reopened this Jun 4, 2019
@meilbn
Copy link
Author

meilbn commented Jun 4, 2019

现在发现一个新的问题,字典中都设置了 CYLTabBarLottieSize(如 24),但是第一个 tabBarItem 的 lottie 图片大小还是 22,第二个大小是指定的。

@ChenYilong
Copy link
Owner

ChenYilong commented Jun 4, 2019

我用你的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)],
               }];
}

@meilbn
Copy link
Author

meilbn commented Jun 4, 2019

真奇怪,公司项目里面第一个就是没成功的,Demo 里面是可以的。
抱歉,我自己再看看,不是库的问题。。。

@meilbn meilbn closed this as completed Jun 4, 2019
@ChenYilong ChenYilong changed the title Lottie 动画是否执行的问题 与 Log in 状态结合决定选中后 Lottie 动画是否执行的问题 Jun 18, 2019
@ChenYilong
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants