关于ios:iOS开发融云会话页面去掉电话号码邮箱链接的样式和点击事件

2次阅读

共计 781 个字符,预计需要花费 2 分钟才能阅读完成。

【iOS 开发】融云会话页面去掉电话号码、邮箱、链接的款式和点击事件

  1. 增加 RCAttributedDataSource 协定,设置 attributeDataSource。
  2. 重置 attributeDictionary。
  3. 重写点击回调。
// 去掉手机号、邮箱、超链接 高亮 + 点击事件
- (void)willDisplayMessageCell:(RCMessageBaseCell *)cell atIndexPath:(NSIndexPath *)indexPath {if ([cell isKindOfClass:[RCTextMessageCell class]]) {RCTextMessageCell *txtCell = (RCTextMessageCell*)cell;
        txtCell.textLabel.attributeDictionary = nil;
        txtCell.textLabel.attributeDataSource = self;
    }
}

- (NSDictionary *)attributeDictionaryForTextType:(NSTextCheckingTypes)textType {return nil;}

/*!
 点击 Cell 中电话号码的回调

 @param phoneNumber 点击的电话号码
 @param model       音讯 Cell 的数据模型
 */
-(void)didTapPhoneNumberInMessageCell:(NSString *)phoneNumber model:(RCMessageModel *)model {

}
/*!
 点击 Cell 中 URL 的回调

 @param url   点击的 URL
 @param model 音讯 Cell 的数据模型
*/
- (void)didTapUrlInMessageCell:(NSString *)url model:(RCMessageModel *)model {}
正文完
 0