ExamArrangeSearchHeader.m 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // ExamArrangeSearchHeader.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2019/7/29.
  6. // Copyright © 2019 Danson. All rights reserved.
  7. //
  8. #import "ExamArrangeSearchHeader.h"
  9. #import "RQSearchView.h"
  10. @interface ExamArrangeSearchHeader ()
  11. @property (nonatomic, readwrite, strong) RQSearchView *searchView;
  12. @end
  13. @implementation ExamArrangeSearchHeader
  14. #pragma mark - Life Cycle
  15. - (instancetype)initWithFrame:(CGRect)frame {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. [self addSubview:self.searchView];
  19. }
  20. __weak typeof (self) weakS = self;
  21. [self addTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
  22. [weakS clickSelf];
  23. }];
  24. return self;
  25. }
  26. - (void)layoutSubviews {
  27. [super layoutSubviews];
  28. if (![self.subviews containsObject:[self rootView].jxTitle]) {
  29. [self insertSubview:self.rootView.jxTitle atIndex:0];
  30. }
  31. [_searchView mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.top.mas_offset(16);
  33. make.centerX.mas_equalTo(self);
  34. make.size.mas_equalTo(CGSizeMake(self.bounds.size.width - 32, ((self.bounds.size.height - 32) / 2.0) - 5));
  35. _searchView.layer.cornerRadius = (((self.bounds.size.height - 32) / 2.0) + 5) / 2.0;
  36. _searchView.layer.masksToBounds = YES;
  37. }];
  38. 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);
  39. }
  40. #pragma mark - Private Functions
  41. - (void)updateSecVUI:(__kindof HDSectionModel *)model {
  42. }
  43. - (void)clickSelf {
  44. self.callback(self.hdSecModel);
  45. }
  46. #pragma mark - LazyLoad
  47. - (RQSearchView *)searchView {
  48. if (!_searchView) {
  49. _searchView = [[RQSearchView alloc] init];
  50. }
  51. return _searchView;
  52. }
  53. @end