WFCUGroupMemberTableViewCell.m 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // WFCUGroupMemberTableViewCell.m
  3. // WFChat UIKit
  4. //
  5. // Created by WF Chat on 2017/9/18.
  6. // Copyright © 2017年 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCUGroupMemberTableViewCell.h"
  9. @implementation WFCUGroupMemberTableViewCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. [self initSubViews];
  14. }
  15. return self;
  16. }
  17. - (void)initSubViews {
  18. self.portraitView = [[UIImageView alloc] initWithFrame:CGRectMake(4, 4, 48, 48)];
  19. self.groupNameView = [[UILabel alloc] initWithFrame:CGRectMake(56, 8, 150, 24)];
  20. if (self.isSelectable) {
  21. }
  22. [self.portraitView setImage:[UIImage imageNamed:@"PersonalChat"]];
  23. [self.contentView addSubview:self.portraitView];
  24. [self.contentView addSubview:_groupNameView];
  25. }
  26. - (void)setIsSelectable:(BOOL)isSelectable {
  27. _isSelectable = isSelectable;
  28. if (isSelectable) {
  29. if (self.selectView == nil) {
  30. self.selectView = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 32, 8, 20, 20)];
  31. self.selectView.image = [UIImage imageNamed:@"multi_unselected"];
  32. [self.contentView addSubview:self.selectView];
  33. }
  34. } else {
  35. if (self.selectView) {
  36. [self.selectView removeFromSuperview];
  37. self.selectView = nil;
  38. }
  39. }
  40. }
  41. - (void)setIsSelected:(BOOL)isSelected {
  42. _isSelected = isSelected;
  43. if (!self.isSelectable) {
  44. self.isSelectable = YES;
  45. }
  46. if (isSelected) {
  47. self.selectView.image = [UIImage imageNamed:@"multi_selected"];
  48. } else {
  49. self.selectView.image = [UIImage imageNamed:@"multi_unselected"];
  50. }
  51. }
  52. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  53. [super setSelected:selected animated:animated];
  54. // Configure the view for the selected state
  55. }
  56. @end