how to insert UIImage into UITextView

2019-04-05 14:22发布

im working on a editable notebook type project. it consists some text and images at any time. in UITextView if we add images as subview the frames are fixed. but i have editable option. so i must save image as NSString format in UITextView, but it should look image type in uipart. so please suggest me how can i handle this requierment.

Thanks in advance

3条回答
2楼-- · 2019-04-05 15:04

Solved as follows. Taken Scrollview, in that managing size of the textview & inserting image with Specified size. Like textview,image,tetxview, image and goes on...

Thanks for all your support to solve the issue.

查看更多
爷的心禁止访问
3楼-- · 2019-04-05 15:09

I know it's too late.
As per my understanding, you can use UIWebView to insert text and images both.
Create an HTML file and put it in app bundle. Set the attribute of div or paragraph(in HTML) as contentEditable = "true". And load that file:-

NSBundle *bundle = [NSBundle mainBundle];
NSURL *indexFileURL = [bundle URLForResource:@"Index" withExtension:@"html"]; // HTML file name is "Index"
[YourWebView loadRequest:[NSURLRequest requestWithURL:indexFileURL]];

This way, your UIWebView becomes editable and you can insert text and image both.

Edit:- Please have a look at this link:- Adding Images to UITextView

查看更多
Fickle 薄情
4楼-- · 2019-04-05 15:11

I think you're asking for something that's not possible.

If you need to truly interleave text and graphics, UIWebView is about your only answer. But it's not editable.

查看更多
登录 后发表回答