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

iOS13下 cyl_tabImageView 获取存在问题,可能无法获取 #381

Closed
cwwise opened this issue Jun 13, 2019 · 2 comments
Closed

iOS13下 cyl_tabImageView 获取存在问题,可能无法获取 #381

cwwise opened this issue Jun 13, 2019 · 2 comments

Comments

@cwwise
Copy link

cwwise commented Jun 13, 2019

enter image description here



Base Info for this issue

UIControl+CYLTabBarControllerExtention 中 cyl_tabImageView

  1. Version:Latest Version as v1.21.x
  2. Language of App :Objective-C
  3. iOS System Version:iOS13
  4. Prototype(是否是真机):NO
  5. Issue Type:Crash、Bug、Enhancement(希望能支持一个新需求)、Q-A
    Bug

1. How to reproduce the problem.

在工程demo MainTabBarController.h中

- (void)tabBarController:(UITabBarController *)tabBarController didSelectControl:(UIControl *)control 
  这个地方代码
 animationView = [control cyl_tabImageView];

如果当前 TabbarItem 是选中状态 点击之后可以获取 animationView,如果当前TabbarItem是未选中状态 点击获取到animationView 值为nil,在iOS12上表现正常。

2. Please help me in this way.

应该都能获取到才是正常的。在iOS12下都可以正常获取到

3. Here is a Demo.

最新版本上就可以复现

4. Here is my Debug log

iOS13下
- (UIImageView *)cyl_tabImageView {
    for (UIImageView *subview in self.subviews) {
        if ([subview cyl_isTabImageView]) {
            return (UIImageView *)subview;
        }
    }
    return nil;
}

当前未选中的情况
(lldb) po self.subviews
<__NSArrayM 0x6000026de130>(
<UIVisualEffectView: 0x7fe6054956c0; frame = (0 0; 93.75 48); userInteractionEnabled = NO; layer = <CALayer: 0x6000028962a0>> clientRequestedContentView effect=<UIVibrancyEffect: 0x600002a3ce30> style=UIBlurEffectStyleSystemChromeBackground vibrancyStyle=_UIVibrancyEffectStyleFill,
<LOTAnimationView: 0x7fe605547220; frame = (29.6667 7; 22 22); userInteractionEnabled = NO; layer = <CALayer: 0x600002875fc0>>
)

当前选中的情况
(lldb) po self.subviews
<__NSArrayM 0x6000026d9ce0>(
<UIVisualEffectView: 0x7fe6054956c0; frame = (0 0; 93.75 48); userInteractionEnabled = NO; layer = <CALayer: 0x6000028962a0>> clientRequestedContentView effect=<UIVibrancyEffect: 0x600002a3ce30> style=UIBlurEffectStyleSystemChromeBackground vibrancyStyle=_UIVibrancyEffectStyleFill,
<LOTAnimationView: 0x7fe605547220; frame = (29.6667 7; 22 22); userInteractionEnabled = NO; layer = <CALayer: 0x600002875fc0>>,
<UITabBarSwappableImageView: 0x7fe6054954d0; frame = (29.6667 7; 22 22); hidden = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x600002896240>>,
<UITabBarButtonLabel: 0x7fe605495230; frame = (30.3333 30.6667; 20.6667 12); text = '首页'; opaque = NO; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x600000ba93b0>>
)


@ChenYilong
Copy link
Owner

ChenYilong commented Jun 13, 2019

这个问题在看了,有什么好的建议欢迎加微信聊chenyilong1010

现在请暂时通过下面的方式解决:
这Demo中:

- (void)customizeTabBarAppearance:(CYLTabBarController *)tabBarController {

添加如下代码:

    if (@available(iOS 13.0, *)) {
        [UITabBar appearance].barTintColor = [UIColor whiteColor];// or other color
    }

或者:

   [[UITabBar appearance] setBackgroundImage:[[self class] imageWithColor: [UIColor whiteColor] size:CGSizeMake([UIScreen mainScreen].bounds.size.width, tabBarController.tabBarHeight ?: (CYL_IS_IPHONE_X ? 65 : 40))]];

或者:

if (@available(iOS 10.0, *)) {
     [[UITabBar appearance] setUnselectedItemTintColor:[UIColor grayColor]];
    }

@ChenYilong
Copy link
Owner

除了上述的办法,也可以直接升级到 v1.27.0,详情见:

#386

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

No branches or pull requests

2 participants