// // ChatMsgNoticeCell.m // smartRhino // // Created by armin on 2019/11/4. // Copyright © 2019 tederen. All rights reserved. // #import "ChatMsgNoticeCell.h" @implementation ChatMsgNoticeCell - (void)awakeFromNib { [super awakeFromNib]; self.cell2UserImgView.layer.cornerRadius = 4.f; self.cell2UserImgView.layer.masksToBounds = YES; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } + (CGFloat)configCell0Height{ return 49.5; } + (CGFloat)configCell1Height{ return 63.5; } + (CGFloat)configCell2Height{ return 64; } + (ChatMsgNoticeCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell0"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:0]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.cell0SearchBgView.layer.masksToBounds = YES; cell.cell0SearchBgView.layer.cornerRadius = 29.5/2.0; cell.cell0SearchBgView.backgroundColor = RGB(245, 246, 248); return cell; } + (ChatMsgNoticeCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell1"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:1]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } + (ChatMsgNoticeCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell2"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:2]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.cell2RedBgView.layer.masksToBounds = YES; cell.cell2RedBgView.layer.cornerRadius = 5.f; cell.cell2RedBgView.hidden = YES; cell.cell2EditBtn.hidden = YES; [cell.cell2EditBtn setTitle:@"编辑" forState:UIControlStateNormal]; return cell; } + (ChatMsgNoticeCell *)configCell10:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell10"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:3]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.rightImageView.hidden = YES; return cell; } + (ChatMsgNoticeCell *)configCell20:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell20"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:4]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.cell2RedBgView.layer.masksToBounds = YES; cell.cell2RedBgView.layer.cornerRadius = 5.f; cell.cell2RedBgView.hidden = YES; cell.rightImageView.hidden = YES; cell.cell2EditBtn.hidden = YES; [cell.cell2EditBtn setTitle:@"编辑" forState:UIControlStateNormal]; return cell; } + (ChatMsgNoticeCell *)configCell30:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell30"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:5]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } + (ChatMsgNoticeCell *)configCell40:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell40"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:6]; } cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } + (ChatMsgNoticeCell *)configCell50:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell50"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:7]; } cell.yanRedNumL.layer.cornerRadius = 8.f; cell.yanRedNumL.layer.masksToBounds = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } + (ChatMsgNoticeCell *)configCell60:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ChatMsgNoticeCell60"; ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:8]; } cell.yanRedNumL.layer.cornerRadius = 8.f; cell.yanRedNumL.layer.masksToBounds = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } - (void)layoutSubviews { [super layoutSubviews]; CGRect rect = self.contentView.frame; rect.size.width += rect.origin.x; rect.origin.x = 0; self.contentView.frame = rect; for (UIView *supView in self.subviews){ if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){ for (UIView *view in supView.subviews) { if ([view isKindOfClass: [UIImageView class]]) { view.hidden = !self.isShow; UIImageView * imagV = (UIImageView *)view; [imagV setFrame:CGRectMake(0, 0, 32, 20)]; imagV.center = supView.center; imagV.contentMode = UIViewContentModeCenter; imagV.image = [UIImage imageNamed: @"list_sort"]; UIView * label = [UIView new]; label.backgroundColor = UIColorHex(0xEEEEEE); [supView addSubview:label]; [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)]; }else{ view.hidden = YES; } } } if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){ [supView removeFromSuperview]; } } } @end