TopicBookCell.m 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. //
  2. // TopicBookCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/7/21.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "TopicBookCell.h"
  9. @implementation TopicBookCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  15. [super setSelected:selected animated:animated];
  16. // Configure the view for the selected state
  17. }
  18. + (TopicBookCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  19. static NSString *cellIdentifer = @"TopicBookCell0";
  20. TopicBookCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  21. if (cell == nil || !cell) {
  22. cell = [[[NSBundle mainBundle] loadNibNamed:@"TopicBookCell" owner:nil options:nil] objectAtIndex:0];
  23. }
  24. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  25. return cell;
  26. }
  27. + (TopicBookCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  28. static NSString *cellIdentifer = @"TopicBookCell1";
  29. TopicBookCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  30. if (cell == nil || !cell) {
  31. cell = [[[NSBundle mainBundle] loadNibNamed:@"TopicBookCell" owner:nil options:nil] objectAtIndex:1];
  32. }
  33. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  34. return cell;
  35. }
  36. + (TopicBookCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  37. static NSString *cellIdentifer = @"TopicBookCell2";
  38. TopicBookCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  39. if (cell == nil || !cell) {
  40. cell = [[[NSBundle mainBundle] loadNibNamed:@"TopicBookCell" owner:nil options:nil] objectAtIndex:2];
  41. }
  42. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  43. return cell;
  44. }
  45. - (void)layoutSubviews
  46. {
  47. [super layoutSubviews];
  48. CGRect rect = self.contentView.frame;
  49. rect.size.width += rect.origin.x;
  50. rect.origin.x = 0;
  51. self.contentView.frame = rect;
  52. for (UIView *supView in self.subviews){
  53. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){
  54. for (UIView *view in supView.subviews)
  55. {
  56. if ([view isKindOfClass: [UIImageView class]])
  57. {
  58. view.hidden = NO;
  59. UIImageView * imagV = (UIImageView *)view;
  60. [imagV setFrame:CGRectMake(0, 0, 22, 18)];
  61. imagV.center = supView.center;
  62. imagV.contentMode = UIViewContentModeCenter;
  63. imagV.image = [UIImage imageNamed: @"list_sort"];
  64. UIView * label = [UIView new];
  65. label.backgroundColor = UIColorHex(0xEEEEEE);
  66. [supView addSubview:label];
  67. [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)];
  68. }else{
  69. view.hidden = YES;
  70. }
  71. }
  72. }
  73. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
  74. [supView removeFromSuperview];
  75. }
  76. }
  77. }
  78. @end