如何将UIImage插入到UITextView中

发布于 2024-08-18 10:00:44 字数 228 浏览 3 评论 0原文

我正在开发一个可编辑的笔记本类型项目。它随时由一些文本和图像组成。 在 UITextView 中,如果我们将图像添加为子视图,则框架是固定的。但我有可编辑选项。所以我必须在 UITextView 中将图像保存为 NSString 格式,但它应该在 uipart 中看起来是图像类型。所以请建议我如何处理这个要求。

提前致谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

被你宠の有点坏 2024-08-25 10:00:44

我认为你正在要求一些不可能的事情。

如果您需要真正交错文本和图形,UIWebView 是您唯一的答案。但它不可编辑。

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.

望她远 2024-08-25 10:00:44

我知道已经太晚了。
根据我的理解,您可以使用 UIWebView 插入文本和图像。
创建一个 HTML 文件并将其放入应用程序包中。将div或paragraph(HTML中)的属性设置为contentEditable = "true"。并加载该文件: -

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

这样,您的 UIWebView 变得可编辑,并且您可以插入文本和图像。

编辑:- 请查看此链接:- 将图像添加到 UITextView

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

百变从容 2024-08-25 10:00:44

解决如下。采用 Scrollview,管理文本视图和文本视图的大小。插入指定尺寸的图像。像textview,image,tetxview,image等等......

感谢您对解决问题的所有支持。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文