RQTabBar.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // RQTabBar.m
  3. // RQCommon
  4. //
  5. // Created by 张嵘 on 2018/11/14.
  6. // Copyright © 2018 张嵘. All rights reserved.
  7. // 自定义系统的TabBar,解决TabBar顶部的细线高度问题
  8. #import "RQTabBar.h"
  9. @interface RQTabBar ()
  10. /// divider
  11. //@property (nonatomic, readwrite, weak) UIView *divider;
  12. @end
  13. @implementation RQTabBar
  14. - (instancetype)initWithFrame:(CGRect)frame {
  15. self = [super initWithFrame:frame];
  16. if (self) {
  17. /// 去掉tabBar的分割线,以及背景图片
  18. [self setShadowImage:[UIImage new]];
  19. self.qmui_backgroundView.backgroundColor = UIColor.whiteColor;
  20. /// 添加细线,
  21. // UIView *divider = [[UIView alloc] init];
  22. // divider.backgroundColor = RQColor(167.0f, 167.0f, 170.0f);
  23. // [self addSubview:divider];
  24. // self.divider = divider;
  25. if (@available(iOS 13.0, *)) {
  26. self.tintColor = RQ_MAIN_COLOR;
  27. } else {
  28. self.tintColor = [UIColor whiteColor];
  29. }
  30. self.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.16].CGColor;
  31. self.layer.shadowOffset = CGSizeMake(1,-1);
  32. self.layer.shadowOpacity = 1;
  33. self.layer.shadowRadius = 3;
  34. }
  35. return self;
  36. }
  37. #pragma mark - 布局
  38. - (void)layoutSubviews {
  39. [super layoutSubviews];
  40. // [self bringSubviewToFront:self.divider];
  41. // self.divider.rq_height = RQGlobalBottomLineHeight;
  42. // self.divider.rq_width = RQ_SCREEN_WIDTH;
  43. }
  44. @end