简体   繁体   中英

UITextView with text and images combined

I have this UIScrollView with images inside, all the images are 30x30. I also have aa 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).

How is it possible?

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];

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM