| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // SocietyLeaveApplyCell.m
- // BuguLive
- //
- // Created by 王珂 on 17/1/22.
- // Copyright © 2017年 xfg. All rights reserved.
- //
- #import "SocietyLeaveApplyCell.h"
- #import "SocietyMemberModel.h"
- @interface SocietyLeaveApplyCell()
- @property (weak, nonatomic) IBOutlet UIImageView *headImgView;
- @property (weak, nonatomic) IBOutlet UILabel *nameLabel;
- @property (weak, nonatomic) IBOutlet UIImageView *sexImgView;
- @property (weak, nonatomic) IBOutlet UIImageView *rankImgView;
- @property (weak, nonatomic) IBOutlet UILabel *commentLabel;
- @property (weak, nonatomic) IBOutlet UIButton *agreeBtn;
- @property (weak, nonatomic) IBOutlet UIButton *refuseBtn;
- @property (nonatomic, strong) UILabel *nameLabel2;
- @property (nonatomic, strong) UIImageView *sexImgView2;
- @property (nonatomic, strong) UIImageView *rankImgView2;
- @property (nonatomic, copy) NSString *user_id;
- @end
- @implementation SocietyLeaveApplyCell
- + (instancetype)cellWithTableView:(UITableView *)tableView
- {
- static NSString *ID = @"SocietyLeaveApplyCell";
- SocietyLeaveApplyCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
- if (cell == nil) {
- cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([SocietyLeaveApplyCell class]) owner:nil options:nil] lastObject];
- }
- return cell;
- }
- - (void)awakeFromNib
- {
- [super awakeFromNib];
-
- self.nameLabel.hidden = YES;
- self.nameLabel2 = [[UILabel alloc]init];
- [self.contentView addSubview:self.nameLabel2];
-
- self.sexImgView.hidden = YES;
- self.sexImgView2 = [[UIImageView alloc]init];
- [self.contentView addSubview:self.sexImgView2];
-
- self.rankImgView.hidden = YES;
- self.rankImgView2 = [[UIImageView alloc]init];
- [self.contentView addSubview:self.rankImgView2];
-
- self.lineView = [[UIView alloc]initWithFrame:CGRectMake(0, 59, kScreenW, 1)];
- self.lineView.backgroundColor = myTextColorLine5;
- [self.contentView addSubview:self.lineView];
- self.headImgView.layer.cornerRadius = 20;
- self.headImgView.layer.masksToBounds = YES;
-
- self.commentLabel.textColor = myTextColorLine3;
- self.agreeBtn.layer.cornerRadius = 15;
- self.agreeBtn.layer.masksToBounds = YES;
- self.agreeBtn.backgroundColor = kAppMainColor;
- self.refuseBtn.layer.cornerRadius = 15;
- self.refuseBtn.layer.masksToBounds = YES;
- self.refuseBtn.backgroundColor =kAppFamilyBtnColor;
- }
- - (void)creatCellWithModel:(SenderModel *)model WithRow:(int)row
- {
- self.user_id = model.user_id;
- [self.headImgView sd_setImageWithURL:[NSURL URLWithString:model.head_image] placeholderImage:kDefaultPreloadHeadImg];
- if (model.nick_name.length < 1)
- {
- model.nick_name = ASLocalizedString(@"暂时还未命名");
- }
- self.nameLabel2.textColor = kGrayTransparentColor6;
- NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:model.nick_name];
- [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15.0]} range:NSMakeRange(0, model.nick_name.length)];
- CGFloat width =[model.nick_name sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]}].width;
- if (width+ 52 > kScreenW-200)//名字控件需要控制长度
- {
- width = kScreenW - 200-52;
- self.nameLabel2.lineBreakMode = NSLineBreakByTruncatingTail;
- }
- self.nameLabel2.frame = CGRectMake(60, 6, width, 21);
- self.sexImgView2.frame = CGRectMake(width+65, 9, 14, 14);
- self.rankImgView2.frame = CGRectMake(width+84, 8, 28, 16);
- self.nameLabel2.attributedText = attr;
-
- if ([model.sex isEqualToString:@"1"])
- {
- self.sexImgView2.image = [UIImage imageNamed:@"com_male_selected"];
- }else
- {
- self.sexImgView2.image = [UIImage imageNamed:@"com_female_selected"];
- }
- self.rankImgView2.image = [UIImage imageNamed:[NSString stringWithFormat:@"level%d",(int)model.user_level]];
- if (model.signature.length < 1)
- {
- self.commentLabel.text = @"";
- }else
- {
- self.commentLabel.lineBreakMode = NSLineBreakByTruncatingTail;
- NSMutableAttributedString *attr1 = [[NSMutableAttributedString alloc] initWithString:model.signature];
- self.commentLabel.attributedText = attr1;
- }
- }
- - (IBAction)clickAgreeBtn:(UIButton *)sender {
- //同意退出公会,做删除操作
- if (_delegate && [_delegate respondsToSelector:@selector(agreeQuitWithSocietyLeaveApplyCell:)]) {
- [_delegate agreeQuitWithSocietyLeaveApplyCell:self];
- }
-
- }
- - (IBAction)clickRefuseBtn:(UIButton *)sender {
- //拒绝退出公会,做删除操作
- if (_delegate && [_delegate respondsToSelector:@selector(refuseQuitWithSocietyLeaveApplyCell:)]) {
- [_delegate refuseQuitWithSocietyLeaveApplyCell:self];
- }
- }
- @end
|