iOS端添加系统表情

2018-02-28  本文已影响0人  Desert_Eagle

对于UITextField或者UITextView,对于系统表情在发送服务器前做编码处理,示例代码如下:

NSCharacterSet *allowedCharacters = [NSCharacterSet characterSetWithCharactersInString:@"!$&'()*+,-./:;=?@_~%#[]"];
    NSString *inputText = [self.originalTextView.text stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];

显示时转码后显示,示例代码如下:

NSCharacterSet *allowedCharacters = [NSCharacterSet characterSetWithCharactersInString:@"!$&'()*+,-./:;=?@_~%#[]"];
NSString *showText = [inputText stringByRemovingPercentEncoding];
上一篇下一篇

猜你喜欢

热点阅读