1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // GroupTableViewCell.m
- // WFChat UIKit
- //
- // Created by WF Chat on 2017/9/13.
- // Copyright © 2017年 WildFireChat. All rights reserved.
- //
- #import "WFCUGroupTableViewCell.h"
- #import "SDWebImage.h"
- @interface WFCUGroupTableViewCell()
- @property (strong, nonatomic) UIImageView *portrait;
- @property (strong, nonatomic) UILabel *name;
- @end
- @implementation WFCUGroupTableViewCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (UIImageView *)portrait {
- if (!_portrait) {
- _portrait = [[UIImageView alloc] initWithFrame:CGRectMake(8, 8, 40, 40)];
- [self.contentView addSubview:_portrait];
- }
- return _portrait;
- }
- - (UILabel *)name {
- if (!_name) {
- _name = [[UILabel alloc] initWithFrame:CGRectMake(56, 16, [UIScreen mainScreen].bounds.size.width - 64, 24)];
- [self.contentView addSubview:_name];
- }
- return _name;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- - (void)setGroupInfo:(WFCCGroupInfo *)groupInfo {
- _groupInfo = groupInfo;
- if (groupInfo.name.length == 0) {
- self.name.text = [NSString stringWithFormat:@"Group<%@>", groupInfo.target];
- } else {
- self.name.text = [NSString stringWithFormat:@"%@(%d)", groupInfo.name, (int)groupInfo.memberCount];
- }
- [self.portrait sd_setImageWithURL:[NSURL URLWithString:groupInfo.portrait] placeholderImage:[UIImage imageNamed:@"group_default_portrait"]];
- }
- @end
|