将笑脸添加到UITextView或UITextField [英] Adding Smileys to UITextView or UITextField

查看:62
本文介绍了将笑脸添加到UITextView或UITextField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何机构都可以指导我向UItextField或UITextView添加笑脸吗?

Can any body guide me to add smileys to UItextField or UITextView?

v在iChat视图中也是可编辑的,因此您可以像v在Desktop中的iChat一样添加/删除它.

As v get in iChat view which is also editable u can add/remove it as v have for iChat in Desktop.

例如:你好:)(这是个笑脸)

Eg: Hello :) (this is smiley)

谢谢 Veena

推荐答案

使用以下代码:

NSRange range = {NSNotFound, 0};
NSString *s = @"This is a smiley :)";

range.location = 0;
range.length = [s length];
s = [s stringByReplacingOccurrencesOfString:@":)"
                                    withString:@"\ue415"
                                    options:NSCaseInsensitiveSearch
                                    range:range];

这篇关于将笑脸添加到UITextView或UITextField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆