zoukankan      html  css  js  c++  java
  • 发布emoji

    - (NSString *)fullStr// 在UITextView中的需要发送的文字文字

    {

        NSMutableString *fullText = [[NSMutableString alloc] init];

            [self.attributedText enumerateAttributesInRange:NSMakeRange(0, self.attributedText.length) options:0 usingBlock:^(NSDictionary<NSString *,id> * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) {

            YSWeiBoNSTextAttachment *attachment = attrs[@"NSAttachment"];// 是否为图片

            if (attachment)// 如果是表情图片

            {

                [fullText appendString:[NSString stringWithFormat:@"%@",attachment.emotion.chs]];// 获取文字对应的描述字符串

            }

            else

            {

                NSAttributedString *attributedString = [self.attributedText attributedSubstringFromRange:range];

                [fullText appendString:attributedString.string];

            }

        }];

        

        return fullText;

    }

  • 相关阅读:
    IPC对象的持续性
    数据结构C++版-图
    数据结构C++版-树
    数据结构C++版-队列
    数据结构C++版-栈
    数据结构C++版-线性表
    转-二值图像连通域标记
    AdaBoost笔记之通俗易懂原理介绍
    AdaBoost笔记之原理
    C++之多态
  • 原文地址:https://www.cnblogs.com/happyEveryData/p/5524796.html
Copyright © 2011-2022 走看看