WFCUGroupMemberTableViewCell.m 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #import "WFCUImage.h"
  10. @implementation WFCUGroupMemberTableViewCell
  11. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  12. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  13. if (self) {
  14. [self initSubViews];
  15. }
  16. return self;
  17. }
  18. - (void)initSubViews {
  19. self.portraitView = [[UIImageView alloc] initWithFrame:CGRectMake(4, 4, 48, 48)];
  20. self.groupNameView = [[UILabel alloc] initWithFrame:CGRectMake(56, 8, 150, 24)];
  21. if (self.isSelectable) {
  22. }
  23. [self.portraitView setImage:[WFCUImage imageNamed:@"PersonalChat"]];
  24. [self.contentView addSubview:self.portraitView];
  25. [self.contentView addSubview:_groupNameView];
  26. }
  27. - (void)setIsSelectable:(BOOL)isSelectable {
  28. _isSelectable = isSelectable;
  29. if (isSelectable) {
  30. if (self.selectView == nil) {
  31. self.selectView = [[UIImageView alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 32, 8, 20, 20)];
  32. self.selectView.image = [WFCUImage imageNamed:@"multi_unselected"];
  33. [self.contentView addSubview:self.selectView];
  34. }
  35. } else {
  36. if (self.selectView) {
  37. [self.selectView removeFromSuperview];
  38. self.selectView = nil;
  39. }
  40. }
  41. }
  42. - (void)setIsSelected:(BOOL)isSelected {
  43. _isSelected = isSelected;
  44. if (!self.isSelectable) {
  45. self.isSelectable = YES;
  46. }
  47. if (isSelected) {
  48. self.selectView.image = [WFCUImage imageNamed:@"multi_selected"];
  49. } else {
  50. self.selectView.image = [WFCUImage imageNamed:@"multi_unselected"];
  51. }
  52. }
  53. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  54. [super setSelected:selected animated:animated];
  55. // Configure the view for the selected state
  56. }
  57. @end