// // ExamArrangeSearchHeader.m // LN_School // // Created by 张嵘 on 2019/7/29. // Copyright © 2019 Danson. All rights reserved. // #import "ExamArrangeSearchHeader.h" #import "RQSearchView.h" @interface ExamArrangeSearchHeader () @property (nonatomic, readwrite, strong) RQSearchView *searchView; @end @implementation ExamArrangeSearchHeader #pragma mark - Life Cycle - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self addSubview:self.searchView]; } __weak typeof (self) weakS = self; [self addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) { [weakS clickSelf]; }]; return self; } - (void)layoutSubviews { [super layoutSubviews]; if (![self.subviews containsObject:[self rootView].jxTitle]) { [self insertSubview:self.rootView.jxTitle atIndex:0]; } [_searchView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_offset(16); make.centerX.mas_equalTo(self); make.size.mas_equalTo(CGSizeMake(self.bounds.size.width - 32, ((self.bounds.size.height - 32) / 2.0) - 5)); _searchView.layer.cornerRadius = (((self.bounds.size.height - 32) / 2.0) + 5) / 2.0; _searchView.layer.masksToBounds = YES; }]; self.rootView.jxTitle.frame = CGRectMake(0, 32 + (self.bounds.size.height - 32) / 2.0 - 5, self.bounds.size.width, ((self.bounds.size.height - 32) / 2.0) + 5); } #pragma mark - Private Functions - (void)updateSecVUI:(__kindof HDSectionModel *)model { } - (void)clickSelf { self.callback(self.hdSecModel); } #pragma mark - LazyLoad - (RQSearchView *)searchView { if (!_searchView) { _searchView = [[RQSearchView alloc] init]; } return _searchView; } @end