CommentModel.m 914 B

123456789101112131415161718192021222324252627282930313233
  1. //
  2. // CommentModel.m
  3. // TheoryNetwork
  4. //
  5. // Created by tederen on 2019/9/29.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "CommentModel.h"
  9. @implementation CommentModel
  10. - (CGFloat)getCellHeight {
  11. UILabel *textLabel = [UILabel new];
  12. textLabel.numberOfLines = 0;
  13. textLabel.font = [UIFont systemFontOfSize:17.5f];
  14. textLabel.text = self.Content;
  15. if (!ISEmptyString(self.Content)){
  16. [ZYCTool setLabel:textLabel withSpace:10.f withFont:textLabel.font setLineSpace:0 setTextSpace:2.f];
  17. }
  18. CGSize textSize = [textLabel sizeThatFits:CGSizeMake(kGXScreenWidth-68-21, MAXFLOAT)];
  19. CGFloat height = 65+textSize.height+15;
  20. if (!ISEmptyString(self.replyName)&&!ISEmptyNumber(self.replyTimes)) {
  21. height += 50;
  22. }
  23. for (CommentSubModel *model in self.CommentReplyResults) {
  24. height += model.getCellHeight + 10;
  25. }
  26. return height;
  27. }
  28. @end