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

UITabBarItem+PPBadgeView not work in iOS 14 #50

Open
AppLog opened this issue Jan 27, 2021 · 1 comment
Open

UITabBarItem+PPBadgeView not work in iOS 14 #50

AppLog opened this issue Jan 27, 2021 · 1 comment

Comments

@AppLog
Copy link

AppLog commented Jan 27, 2021

In iOS 14, can not add a badge view in UITabBarItem.
Debug the code ,we can see that :

- (UIView *)bottomView
{
    // 通过Xcode视图调试工具找到UITabBarItem原生Badge所在父视图
    UIView *tabBarButton = [self valueForKey:@"_view"];
    for (UIView *subView in tabBarButton.subviews) {
        if (subView.superclass == NSClassFromString(@"UIImageView")) {
            return subView;
        }
    }
    return tabBarButton;
}

The line code [self valueForKey:@"_view"] return nil.
Can not get a view as container for badge view.

@AppLog
Copy link
Author

AppLog commented Jan 27, 2021

After debug activity, I found that after the UITabBarController had finished initial and start working ,then we can add badge view.

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

No branches or pull requests

1 participant