12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- //
- // GroupSquareCell.m
- // smartRhino
- //
- // Created by niuzhen on 2020/5/6.
- // Copyright © 2020 tederen. All rights reserved.
- //
- #import "GroupSquareCell.h"
- @implementation GroupSquareCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- self.JoinBtn.layer.cornerRadius = 2.f;
- self.JoinBtn.layer.borderWidth = 0.5f;
- self.JoinBtn.layer.borderColor = UIColorHex(0x13A3FF).CGColor;
- self.JoinBtn.layer.masksToBounds = YES;
- }
- + (CGFloat)configCell0Height
- {
- return 60.f;
- }
- + (CGFloat)configCell1Height
- {
- return 98.f;
- }
- + (GroupSquareCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
- static NSString *cellIdentifer = @"GroupSquareCell0";
- GroupSquareCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"GroupSquareCell" owner:nil options:nil] objectAtIndex:0];
- }
- return cell;
- }
- + (GroupSquareCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
- static NSString *cellIdentifer = @"GroupSquareCell1";
- GroupSquareCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"GroupSquareCell" owner:nil options:nil] objectAtIndex:1];
- }
- return cell;
- }
- - (void)setLeftDataModel:(GroupSquareModel *)model
- {
- self.BlueView.hidden = !model.isSelect;
- if (model.isSelect) {
- self.NameL.textColor = UIColorHex(0x262626);
- self.contentView.backgroundColor = UIColorHex(0xffffff);
- self.NameL.font = [UIFont systemFontOfSize:15];
- }else{
- self.NameL.textColor = UIColorHex(0x333333);
- self.contentView.backgroundColor = UIColorHex(0xF2F2F2);
- self.NameL.font = [UIFont systemFontOfSize:13];
- }
- self.NameL.text = model.PiazzaName;
- }
- - (void)setRightDataSubModel:(GroupSquareSubModel *)model
- {
- [self.IconView sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:IMG(@"img_placeHolder")];
- self.titleL.text = model.Name;
- self.userCountL.text = [self userCountText:model.UserCount];
- self.TopicCountL.text = [NSString stringWithFormat:@"%ld",model.GroupArticleCount];
- self.subTitleL.text = model.Introduce;
- }
- - (NSString *)userCountText:(NSInteger)userCount
- {
- if (userCount >= 1000) {
- CGFloat s = userCount / 1000;
- return [NSString stringWithFormat:@"%.1f%@",s,@"k"];
- }else{
- return [NSString stringWithFormat:@"%ld",userCount];
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|