| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // RAHomeSectionHeaderView.m
- // Apex And Drivers
- //
- // Created by Jack on 2018/9/5.
- // Copyright © 2018年 USAI. All rights reserved.
- //
- #import "RAHomeSectionHeaderView.h"
- #import "RABadgeNumberView.h"
- const int TagBase = 6000;
- @interface RAHomeSectionHeaderView ()
- @property (nonatomic,strong) IBOutlet UILabel *titleLaebl;
- @property (nonatomic,strong) IBOutlet RABadgeNumberView *badgeView;
- @property (nonatomic,strong) IBOutlet UIButton *moreBtn;
- @property (nonatomic,strong) IBOutlet UIView *backgroundView;
- @end
- @implementation RAHomeSectionHeaderView
- + (instancetype)homeSectionHeader {
- return [[[NSBundle mainBundle] loadNibNamed:@"HomeHeader" owner:nil options:nil] objectAtIndex:0];
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
-
- self.model = nil;
-
- self.backgroundView.layer.cornerRadius = 10.0f;
- self.backgroundView.layer.masksToBounds = YES;
- self.backgroundView.backgroundColor = ApexDriverGrayColor;
- self.titleLaebl.textColor = ApexDriverWhiteColor;
- [self.moreBtn setTitleColor:ApexDriverOrangeColor forState:UIControlStateNormal];
- }
- - (void)addMoreClickTarget:(id)target selector:(SEL)selector {
- [self.moreBtn addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
- }
- - (void)setModel:(RAHomeSectionModel *)model {
- if (_model) {
- _model.delegate = nil;
- }
- _model = model;
- if (_model) {
- _model.delegate = self;
- }
-
- [self refreshUI];
- }
- - (void)refreshUI {
- self.titleLaebl.text = _model.title;
- self.badgeView.badgeNumber = _model.backendFlagCount;
- self.moreBtn.tag = TagBase + _model.section;
- self.moreBtn.hidden = !_model.hasMoreOrder;
- }
- @end
|