UITextView结合了文本和图像 [英] UITextView with text and images combined

查看:72
本文介绍了UITextView结合了文本和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个UIScrollView里面有图像,所有图像都是30x30。我在scrollview下也有一个UITextView。我想要做的是编辑textview,写一些文本,而不是将图像拖到textview,它将在文本之后添加(如表情符号)。

I have this UIScrollView with images inside, all the images are 30x30. I also have a a UITextView under the scrollview. What I want to do is to edit the textview, write some text, than to drag the image to the textview, and it will be added after the text (like emoji).

怎么可能?

推荐答案

你可以添加 UIImageView 作为 UITextView 的子视图。
如此,创建一个带图像的imageView:

You can add the UIImageView as a subView of UITextView. such like, Create an imageView with image:

UIImageView *imageView = [[UIImageView alloc] initWithImage:yourImage];
[imageView setFrame:yourFrame];
[yourTextView addSubview:imageView];

这是源代码可能对您的情况有所帮助:
https://github.com/HansPinckaers/GrowingTextView

https://github.com/enormego/EGOTextView

https://www.cocoacontrols.com/controls/imgglyph

https://www.cocoacontrols.com/controls/secoretextview

http://ios-blog.co.uk/featured-posts/ios-5-rich-text-editing-series /

And This is source code might be helpful in your case: https://github.com/HansPinckaers/GrowingTextView
https://github.com/enormego/EGOTextView
https://www.cocoacontrols.com/controls/imgglyph
https://www.cocoacontrols.com/controls/secoretextview
http://ios-blog.co.uk/featured-posts/ios-5-rich-text-editing-series/

这篇关于UITextView结合了文本和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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