12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // RQTabBar.m
- // RQCommon
- //
- // Created by 张嵘 on 2018/11/14.
- // Copyright © 2018 张嵘. All rights reserved.
- // 自定义系统的TabBar,解决TabBar顶部的细线高度问题
- #import "RQTabBar.h"
- @interface RQTabBar ()
- /// divider
- @property (nonatomic, readwrite, weak) UIView *divider;
- @end
- @implementation RQTabBar
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- /// 去掉tabBar的分割线,以及背景图片
- [self setShadowImage:[UIImage new]];
- [self setBackgroundImage:[UIImage yy_imageWithColor:UIColor.whiteColor]];
- self.backgroundColor = UIColor.whiteColor;
- /// 添加细线,
- UIView *divider = [[UIView alloc] init];
- divider.backgroundColor = RQColor(167.0f, 167.0f, 170.0f);
- [self addSubview:divider];
- self.divider = divider;
-
- if (@available(iOS 13.0, *)) {
- self.tintColor = RQ_MAIN_COLOR;
- } else {
- self.tintColor = [UIColor whiteColor];
- }
- }
- return self;
- }
- #pragma mark - 布局
- - (void)layoutSubviews {
- [super layoutSubviews];
-
- [self bringSubviewToFront:self.divider];
- self.divider.rq_height = RQGlobalBottomLineHeight;
- self.divider.rq_width = RQ_SCREEN_WIDTH;
- }
- @end
|