12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- //
- // HomeTeacherCell.m
- // smartRhino
- //
- // Created by niuzhen on 2020/6/10.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "HomeTeacherCell.h"
- @implementation HomeTeacherCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- self.collectBtn.layer.cornerRadius = 4.f;
- self.collectBtn.layer.borderWidth = 0.5f;
- self.collectBtn.layer.borderColor = UIColorHex(0xBBBBBB).CGColor;
- self.collectBtn.layer.masksToBounds = YES;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- + (HomeTeacherCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
- static NSString *cellIdentifer = @"HomeTeacherCell";
- HomeTeacherCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"HomeTeacherCell" owner:nil options:nil] objectAtIndex:0];
- }
- return cell;
- }
- - (void)setDataWithModel:(HomeSubItemModel *)model
- {
- [self.imagV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrl] placeholderImage:IMG(@"img_placeHolder")];
- self.subTitleL.text = ISEmpty(model.Job) ? @"" : model.Job;
- self.nameL.text = ISEmpty(model.Name) ? @"" : model.Name;
- self.countl.text = [NSString stringWithFormat:@"收藏量:%ld",model.CollectCount];
- if (model.IsCollect) {
- self.collectBtn.layer.borderColor = UIColorHex(0xBBBBBB).CGColor;
- [self.collectBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
- [self.collectBtn setTitle:@"已收藏" forState:UIControlStateNormal];
- }else{
- self.collectBtn.layer.borderColor = UIColorHex(0x13A3FF).CGColor;
- [self.collectBtn setTitleColor:UIColorHex(0x13A3FF) forState:UIControlStateNormal];
- [self.collectBtn setTitle:@"收藏" forState:UIControlStateNormal];
- }
- WS(weakSelf);
- [self.collectBtn setAction:^{
- if (weakSelf.ClickCollectBlock) {
- weakSelf.ClickCollectBlock(model.Id);
- }
- }];
- }
- - (void)setDataWithModel:(HomeSubItemModel *)model searchText:(NSString *)text
- {
- [self.imagV sd_setImageWithURL:[NSURL URLWithString:model.ImageUrls] placeholderImage:IMG(@"img_placeHolder")];
- self.subTitleL.text = model.Summary;
- self.nameL.attributedText = [ZYCTool checkOfString:model.Title withSearchText:text withColor:UIColorHex(0xFF5252)];
- self.countl.text = [NSString stringWithFormat:@"收藏:%ld",model.CollectCount];
- self.collectBtn.hidden = YES;
- }
- @end
|