Correo electrónico, estilo de enlace y evento de clic 1. Agregue el protocolo RCAttributedDataSource y establezca en

[Desarrollo de IOS] La página de conversación de Rongyun elimina números de teléfono, correos electrónicos, estilos de enlaces y eventos de clic

  1. Agregue el protocolo RCAttributedDataSource y configure el atributoDataSource.
  2. Restablezca el atributoDictionary.
  3. Anule la devolución de llamada de clic.
// 去掉手机号、邮箱、超链接 高亮+点击事件
- (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 {

}

Supongo que te gusta

Origin blog.51cto.com/15056506/2678329
Recomendado
Clasificación