iOS13 tabbar 顶部黑线 及背景图片

//iOS 13 顶部灰线

     UIView *contentView = self.subviews.firstObject;

      [contentView.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {

          if ([NSStringFromClass(obj.class) isEqualToString:@"UIImageView"]) {

              UIImageView *imageView = (UIImageView *)obj;

              imageView.backgroundColor = UIColor.clearColor;

              imageView.image = nil;

          }

    }];

//iOS 13 背景

    UIView *barBackground = self.subviews.firstObject;

    if ([NSStringFromClass(barBackground.class) isEqualToString:@"_UIBarBackground"]) {

        UIImageView *image= [[UIImageView alloc]initWithFrame:CGRectMake(0, -5, SCREEN_WIDTH,self.frame.size.height)];

        [barBackground addSubview:image];

        barBackground.backgroundColor=UIColor.clearColor;

        image.image=[[UIImage imageNamed:@"tabBar_bac"] resizableImageWithCapInsets:UIEdgeInsetsMake(43,10,10,10) resizingMode:UIImageResizingModeStretch];

      

    }

你可能感兴趣的:(iOS13 tabbar 顶部黑线 及背景图片)