2
0

WFCUConferenceInviteCell.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // InformationCell.m
  3. // WFChat UIKit
  4. //
  5. // Created by WF Chat on 2017/9/1.
  6. // Copyright © 2017年 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCUConferenceInviteCell.h"
  9. #import <WFChatClient/WFCChatClient.h>
  10. #import "WFCUUtilities.h"
  11. #define TEXT_TOP_PADDING 6
  12. #define TEXT_BUTTOM_PADDING 6
  13. #define TEXT_LEFT_PADDING 8
  14. #define TEXT_RIGHT_PADDING 8
  15. #define TEXT_LABEL_TOP_PADDING TEXT_TOP_PADDING + 4
  16. #define TEXT_LABEL_BUTTOM_PADDING TEXT_BUTTOM_PADDING + 4
  17. #define TEXT_LABEL_LEFT_PADDING 30
  18. #define TEXT_LABEL_RIGHT_PADDING 30
  19. @interface WFCUConferenceInviteCell ()
  20. @property (nonatomic, strong)UILabel *titleLabel;
  21. @property (nonatomic, strong)UILabel *infoLabel;
  22. @property (nonatomic, strong)UIView *separateLine;
  23. @property (nonatomic, strong)UILabel *hint;
  24. @end
  25. @implementation WFCUConferenceInviteCell
  26. + (CGSize)sizeForClientArea:(WFCUMessageModel *)msgModel withViewWidth:(CGFloat)width {
  27. return CGSizeMake(width, 84);
  28. }
  29. - (void)setModel:(WFCUMessageModel *)model {
  30. [super setModel:model];
  31. WFCCConferenceInviteMessageContent *content = (WFCCConferenceInviteMessageContent *)model.message.content;
  32. self.titleLabel.text = [NSString stringWithFormat:@"会议邀请:%@", content.title];
  33. if (content.startTime == 0 || content.startTime >= [[NSDate alloc] init].timeIntervalSince1970) {
  34. self.infoLabel.text = @"会议已经开始了,请尽快加入会议。";
  35. } else {
  36. self.infoLabel.text = @"会议还未开始,请准时参加。";
  37. }
  38. [self separateLine];
  39. [self hint];
  40. }
  41. - (UILabel *)infoLabel {
  42. if (!_infoLabel) {
  43. CGRect bounds = self.contentArea.bounds;
  44. _infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 30, bounds.size.width-16, 32)];
  45. _infoLabel.numberOfLines = 0;
  46. _infoLabel.font = [UIFont systemFontOfSize:14];
  47. _infoLabel.textColor = [UIColor grayColor];
  48. _infoLabel.numberOfLines = 0;
  49. _infoLabel.font = [UIFont systemFontOfSize:12.f];
  50. [self.contentArea addSubview:_infoLabel];
  51. }
  52. return _infoLabel;
  53. }
  54. - (UILabel *)titleLabel {
  55. if (!_titleLabel) {
  56. CGRect bounds = self.contentArea.bounds;
  57. _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 8, bounds.size.width - 16, 18)];
  58. _titleLabel.numberOfLines = 0;
  59. _titleLabel.font = [UIFont systemFontOfSize:14];
  60. _titleLabel.textColor = [UIColor blackColor];
  61. _titleLabel.numberOfLines = 1;
  62. _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  63. _titleLabel.font = [UIFont systemFontOfSize:14.f];
  64. [self.contentArea addSubview:_titleLabel];
  65. }
  66. return _titleLabel;
  67. }
  68. - (UIView *)separateLine {
  69. if (!_separateLine) {
  70. CGRect bounds = self.contentArea.bounds;
  71. _separateLine = [[UIView alloc] initWithFrame:CGRectMake(8, 64, bounds.size.width - 8 - 8, 1)];
  72. _separateLine.backgroundColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0];
  73. [self.contentArea addSubview:_separateLine];
  74. }
  75. return _separateLine;
  76. }
  77. - (UILabel *)hint {
  78. if (!_hint) {
  79. _hint = [[UILabel alloc] initWithFrame:CGRectMake(8, 68, 80, 16)];
  80. _hint.font = [UIFont systemFontOfSize:8];
  81. _hint.text = @"野火会议";
  82. _hint.textColor = [UIColor grayColor];
  83. [self.contentArea addSubview:_hint];
  84. }
  85. return _hint;
  86. }
  87. @end