Jelajahi Sumber

会议邀请消息UI

heavyrain2012 4 tahun lalu
induk
melakukan
16ea95e6e4

+ 59 - 24
wfuikit/WFChatUIKit/MessageList/Cell/WFCUConferenceInviteCell.m

@@ -9,7 +9,6 @@
 #import "WFCUConferenceInviteCell.h"
 #import <WFChatClient/WFCChatClient.h>
 #import "WFCUUtilities.h"
-#import "UILabel+YBAttributeTextTapAction.h"
 
 #define TEXT_TOP_PADDING 6
 #define TEXT_BUTTOM_PADDING 6
@@ -23,53 +22,89 @@
 #define TEXT_LABEL_RIGHT_PADDING 30
 
 @interface WFCUConferenceInviteCell ()
+@property (nonatomic, strong)UILabel *titleLabel;
 @property (nonatomic, strong)UILabel *infoLabel;
+
+@property (nonatomic, strong)UIView *separateLine;
+@property (nonatomic, strong)UILabel *hint;
 @end
 
 @implementation WFCUConferenceInviteCell
 
 + (CGSize)sizeForClientArea:(WFCUMessageModel *)msgModel withViewWidth:(CGFloat)width {
-    return CGSizeMake(width, 80);
+    return CGSizeMake(width, 84);
 }
 
 - (void)setModel:(WFCUMessageModel *)model {
     [super setModel:model];
     
-    CGRect frame = self.contentArea.bounds;
     
     WFCCConferenceInviteMessageContent *content = (WFCCConferenceInviteMessageContent *)model.message.content;
-    [self.infoLabel yb_removeAttributeTapActions];
-    
-    self.infoLabel.text = @"邀请您参加会议";
-    self.infoLabel.textColor = [UIColor grayColor];
-    
-    self.infoLabel.layoutMargins = UIEdgeInsetsMake(TEXT_TOP_PADDING, TEXT_LEFT_PADDING, TEXT_BUTTOM_PADDING, TEXT_RIGHT_PADDING);
-    self.infoLabel.frame = frame;
+
+    self.titleLabel.text = [NSString stringWithFormat:@"会议邀请:%@", content.title];
+    if (content.startTime == 0 || content.startTime >= [[NSDate alloc] init].timeIntervalSince1970) {
+        self.infoLabel.text = @"会议已经开始了,请尽快加入会议。";
+    } else {
+        self.infoLabel.text = @"会议还未开始,请准时参加。";
+    }
+
+    [self separateLine];
+    [self hint];
 }
 
 - (UILabel *)infoLabel {
     if (!_infoLabel) {
-        _infoLabel = [[UILabel alloc] init];
+        CGRect bounds = self.contentArea.bounds;
+        _infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 30, bounds.size.width-16, 32)];
         _infoLabel.numberOfLines = 0;
         _infoLabel.font = [UIFont systemFontOfSize:14];
         
-        _infoLabel.textColor = [UIColor whiteColor];
+        _infoLabel.textColor = [UIColor grayColor];
         _infoLabel.numberOfLines = 0;
-        _infoLabel.lineBreakMode = NSLineBreakByTruncatingTail;
-        _infoLabel.textAlignment = NSTextAlignmentCenter;
-        _infoLabel.font = [UIFont systemFontOfSize:14.f];
-        _infoLabel.layer.masksToBounds = YES;
-        _infoLabel.layer.cornerRadius = 5.f;
-        _infoLabel.textAlignment = NSTextAlignmentCenter;
-        _infoLabel.backgroundColor = [UIColor clearColor];
-        
-        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTaped:)];
-        [_infoLabel addGestureRecognizer:tap];
-        tap.cancelsTouchesInView = NO;
-        [_infoLabel setUserInteractionEnabled:YES];
+        _infoLabel.font = [UIFont systemFontOfSize:12.f];
         
         [self.contentArea addSubview:_infoLabel];
     }
     return _infoLabel; 
 }
+
+- (UILabel *)titleLabel {
+    if (!_titleLabel) {
+        CGRect bounds = self.contentArea.bounds;
+        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 8, bounds.size.width - 16, 18)];
+        _titleLabel.numberOfLines = 0;
+        _titleLabel.font = [UIFont systemFontOfSize:14];
+        
+        _titleLabel.textColor = [UIColor blackColor];
+        _titleLabel.numberOfLines = 1;
+        _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
+        _titleLabel.font = [UIFont systemFontOfSize:14.f];
+        
+        
+        [self.contentArea addSubview:_titleLabel];
+    }
+    return _titleLabel;
+}
+
+
+- (UIView *)separateLine {
+    if (!_separateLine) {
+        CGRect bounds = self.contentArea.bounds;
+        _separateLine = [[UIView alloc] initWithFrame:CGRectMake(8, 64, bounds.size.width - 8 - 8, 1)];
+        _separateLine.backgroundColor = [UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0];
+        [self.contentArea addSubview:_separateLine];
+    }
+    return _separateLine;
+}
+
+- (UILabel *)hint {
+    if (!_hint) {
+        _hint = [[UILabel alloc] initWithFrame:CGRectMake(8, 68, 80, 16)];
+        _hint.font = [UIFont systemFontOfSize:8];
+        _hint.text = @"野火会议";
+        _hint.textColor = [UIColor grayColor];
+        [self.contentArea addSubview:_hint];
+    }
+    return _hint;
+}
 @end