// // KBSignInClickView.m // YouHuiProject // // Created by jcymac on 2018/10/15. // Copyright © 2018年 kuxuan. All rights reserved. // #import "KBSignInClickView.h" #import "KBSignInTableViewCell.h" @interface KBSignInClickView () @end @implementation KBSignInClickView /* // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - (void)drawRect:(CGRect)rect { // Drawing code } */ - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor clearColor]; self.clickTableArry = [NSMutableArray arrayWithCapacity:0]; [self makeUI]; } return self; } - (void)makeUI { [self addSubview:self.clickTableView]; [self.clickTableView registerClass:[KBSignInTableViewCell class] forCellReuseIdentifier:@"KBSignInTableViewCell"]; } - (void)refreshTableViewWithArry:(NSArray *)tableArry { [self.clickTableArry removeAllObjects]; for (NSDictionary *dic in tableArry) { KBSignDetailModel *model = [KBSignDetailModel yy_modelWithJSON:dic]; [self.clickTableArry addObject:model]; } [self.clickTableView reloadData]; } - (UITableView *)clickTableView { if (!_clickTableView) { _clickTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0 , FITSIZE(323), FITSIZE(72*4)) style:UITableViewStylePlain]; _clickTableView.estimatedSectionHeaderHeight = 0; _clickTableView.estimatedSectionFooterHeight = 0; _clickTableView.delegate = self; _clickTableView.dataSource = self; _clickTableView.showsVerticalScrollIndicator = NO; _clickTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _clickTableView.backgroundColor = [UIColor clearColor]; _clickTableView.scrollEnabled = NO; } return _clickTableView; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.clickTableArry.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { KBSignInTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KBSignInTableViewCell" forIndexPath:indexPath]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.clickDelegate = self; [cell refreshCellWithModel:self.clickTableArry[indexPath.row] andIndexPath:indexPath]; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return FITSIZE(72); } - (void)clickCellIndexPath:(NSIndexPath *)index { [self.clickViewDelegate clickViewIndexPath:index]; } @end