如何自定义聊天页面右下角 unReadNewMessageLabel 控件

  1. 会话页面RCConversationViewController类的子类添加下面属性值
/*! 
  右下角未读消息数提示的 Label
 */
 
@property (nonatomic, strong) UIImageView *unreadRightBottomIcon;

2.会话页面RCConversationViewController类的子类添加以下方法,部分内容可以根据自己的需求进行更改:

@synthesize unReadNewMessageLabel = _unReadNewMessageLabel;
- (UILabel *)unReadNewMessageLabel {
    if (!_unReadNewMessageLabel) {
        _unReadNewMessageLabel = [[UILabel alloc] initWithFrame:_unreadRightBottomIcon.bounds];
        _unReadNewMessageLabel.backgroundColor = [UIColor clearColor];
        _unReadNewMessageLabel.font = [UIFont systemFontOfSize:12.0f];
        _unReadNewMessageLabel.textAlignment = NSTextAlignmentCenter;
        _unReadNewMessageLabel.textColor = [UIColor redColor];
        _unReadNewMessageLabel.center = CGPointMake(_unReadNewMessageLabel.frame.size.width / 2,
                                                    _unReadNewMessageLabel.frame.size.height / 2 - 2.5);
        [self.unreadRightBottomIcon addSubview:_unReadNewMessageLabel];
    }
    return _unReadNewMessageLabel;
}
- (UIImageView *)unreadRightBottomIcon {
    if (!_unreadRightBottomIcon) {
        UIImage *msgCountIcon = [RCKitUtility imageNamed:@"bubble" ofBundle:@"RongCloud.bundle"];
        _unreadRightBottomIcon = [[UIImageView alloc]
                                  initWithFrame:CGRectMake(self.view.frame.size.width - 5.5 - 35,
                                                           self.chatSessionInputBarControl.frame.origin.y - 12 - 35, 35, 35)];
        _unreadRightBottomIcon.userInteractionEnabled = YES;
        _unreadRightBottomIcon.image = msgCountIcon;
        UITapGestureRecognizer *tap =
        [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tabRightBottomMsgCountIcon:)];
        [_unreadRightBottomIcon addGestureRecognizer:tap];
        _unreadRightBottomIcon.hidden = YES;
        [self.view addSubview:_unreadRightBottomIcon];
    }
    return _unreadRightBottomIcon;
}