// // KDPNavBar.m // KuDianProject // // Created by 学丽 on 2019/7/4. // Copyright © 2019 KDP. All rights reserved. // #import "KDPNavBar.h" @implementation KDPNavBar -(instancetype)initWithFrame:(CGRect)frame { self =[super initWithFrame:frame]; if (self) { [self addSubview:self.navTitleLabel]; [self addSubview:self.lineView]; [self.navTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(50); make.right.mas_equalTo(-50); make.top.mas_equalTo(KDStatusHeight); make.height.mas_equalTo(44); }]; [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.mas_bottom).offset(-1); make.left.right.mas_equalTo(0); make.height.mas_equalTo(1); }]; } return self; } -(void)setLineViewWithHidden:(BOOL)status { self.lineView.hidden=status; } -(void)addleftReturnButton:(id)target selector:(SEL)selector { UIButton *returnBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, KDStatusHeight, 44, 44)]; [returnBtn setImage:[UIImage imageNamed:@"return_white"] forState:UIControlStateNormal]; [returnBtn addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside]; // [returnBtn bringSubviewToFront:[UIApplication sharedApplication].keyWindow]; [self addSubview:returnBtn]; } -(UILabel *)navTitleLabel { if (!_navTitleLabel) { _navTitleLabel=[[UILabel alloc]init]; _navTitleLabel.textAlignment=NSTextAlignmentCenter; _navTitleLabel.font=[UIFont systemFontOfSize:17]; _navTitleLabel.textColor=[UIColor whiteColor]; } return _navTitleLabel; } -(UIView *)lineView { if (!_lineView) { _lineView=[[UIView alloc]init]; _lineView.backgroundColor=[UIColor colorWithHexString:LineColor]; _lineView.hidden=YES; } return _lineView; } @end