- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在 UIWebView
中加载一些 html 内容。内容看起来像这样
<img alt="" src="/image/968" style="width: 75px; height: 26px;">qweqwwqeqwe<img src="/image/969" width="32" height="32"></p>
这部分工作正常。我正在使用从 iOS5.0 开始支持的 UIWebView
的 contentEditable
属性。我将内容包装在一个
<div contentEditable="true">mycontent</div>.
我能够编写/复制文本等。但是当我尝试从 webView
选择并复制图像并将其粘贴到下一行时,我的应用程序崩溃了(EXC_BAD_ACCESS
)。我在 iPad 1 上运行 iOS 5.1.1。我试过检查
[[UIPasteboard generalPasteboard] image]
[[UIPasteboard generalPasteboard] images]
[[UIPasteboard generalPasteboard] url]
[[UIPasteboard generalPasteboard] urls]
但在我复制图像并检查它们之后,它们总是null
或包含零对象。任何指针将不胜感激?
最佳答案
我使用以下代码将 html 字符串加载到 webView
中并对其进行编辑。它运行良好。
#import "WebViewEditViewController.h"
@interface WebViewEditViewController ()
@end
@implementation WebViewEditViewController
- (void)viewDidLoad
{
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *htmlString=@"<html><body><div contentEditable=\"true\"><img alt=\"\" src=\"1.jpg\" style=\"width: 100px; height: 100px;\">qweqwwqeqwe<img src=\"2.jpg\" width=\"150px\" height=\"70px\"></p></div></body></html>";
[_webView loadHTMLString:htmlString baseURL:baseURL];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
我尝试在复制后打印日志,发现 [[UIPasteboard generalPasteboard] image]
在两种情况下都粘贴了 null
,而代码工作正常。
关于iphone - UIWebView contentEditable 图像复制粘贴崩溃 (EXC_BAD_ACCESS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13891553/
我希望能够将包裹在跨度中的图像插入到可编辑的 div 中。我可以做到这一点没问题,但是当我开始打字时,在图像之后,它会将我的文本插入到图像跨度中。如何在刚刚插入的跨度之后定位光标? Here是我的 f
我正在尝试将一些 MathJax 代码插入到 contentEditable div 中,如下所示: 和 JS $(document).ready(funct
我对父级 contenteditable="true"中的嵌套 contenteditable="false"元素有非常不同的行为: I'm supposed to be edit
问题: 我在 Chrome 和 Opera 中观察到一个不受欢迎的行为,当一个连接两个 p通过删除它们之间的分隔来标记。 Chrome 和 Opera 删除 contenteditable=false
我在渲染我的组件时收到以下警告: Warning: A component is contentEditable and contains children managed by React. It
我们已经使用单列网格实现了 React-Vitualized,其中的行为键盘事件 (onKeyUp/onKeyDown/onKeyPress) 启用。我们正在使用 Arrow-Key-Stepper
我有一个 contenteditable div,它包含几个 dontEdit 类的 span。有没有一种方法可以使 span 不可编辑,而 div 的其余部分保持可编辑。 editable
我正在尝试绑定(bind)一个 vue.js 事件以通过 contenteditable=true 检测元素上的更改。 这触发了我的vue.js vue中的trigger方法,但是我好像抓不到模型值
请参阅以下示例: Codepen example Some more text here not editable Hi this is my content $(document).on(
奇怪的是,这只在 Firefox 和 Opera 中被破坏(IE、Chrome 和 Safari 可以正常工作)。 有什么快速修复的建议吗? http://ajax.googleapis.co
无论如何我可以使用这样的东西: console.log(e)}>Testing 内部react-contenteditable处理 Testing 的点击关键字? 当我使用 html 属性时,它只需
我的插入符不在跨度之间,下面的例子 REPLY||stick together||CONFIRM||stick together||Name||stick together||Office 我所有的跨
我在使用 contenteditable 元素时遇到了不希望的行为。在 contenteditable=true 的父元素中嵌套 contenteditable=false 的 block 元素时,我
我有一个 div,它通过使用 contenteditable 用作“输入”,并且在启用时效果很好。但是在一种情况下,我需要通过设置 contenteditable='false' 来禁用“输入”,这会
目标:将 keydown 事件处理程序附加到作为 contenteditable div 子元素的 contenteditable span。 问题:如果您输入跨度,则会触发父事件而不是子事件。我想要
我有以下 HTML 旨在确保内部 span 不可编辑。这适用于其他浏览器,但不适用于 IE8。 Luke, I am your father. I'm your son?! Ewww!
我的网页中有一个 contenteditable div,但现在我需要的是,当超过 div 的最大高度时,将自动创建相同的新 div。 div 看起来也和之前的一样。不仅一个 div 会出现,它会是
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 8年前关闭。 Improve thi
从我读到的内容来看,浏览器在处理 contenteditable 元素方面存在相当多的差异。 (即 link )。当“contenteditable=true”元素包含“contenteditable
当我清除一个contenteditable div的内容时,光标立即丢失,我无法通过点击将其恢复。所以如果我清除一次就无法添加任何内容。 在这里检查一下: asdasd x 删除第一行的“
我是一名优秀的程序员,十分优秀!