iOS 去掉底部tabBar的黑线(适配iOS13))

网上找了好多都不起作用,下面这个亲测有效!
效果图.png
 CGRect rect = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
 UIGraphicsBeginImageContext(rect.size);
 CGContextRef context = UIGraphicsGetCurrentContext();
 CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
 CGContextFillRect(context, rect);
 UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
 UIGraphicsEndImageContext();
  if (@available(iOS 13.0, *)) {
            UITabBarAppearance *tabBarAppearance = [self.tabBar.standardAppearance copy];
            [tabBarAppearance setBackgroundImage:img];
            [tabBarAppearance setShadowColor:[UIColor clearColor]];
            [self.tabBar setStandardAppearance:tabBarAppearance];
        } else {
            [self.tabBar setBackgroundImage:img];
            [self.tabBar setShadowImage:img];
        }

你可能感兴趣的:(iOS 去掉底部tabBar的黑线(适配iOS13)))