【发布时间】:2012-10-22 07:04:51
【问题描述】:
我需要与代码http://code.kwint.in/emoji/source/ 通信。我已经编写了将 iPhone 表情符号添加到网络视图(编辑器)的代码,但它不显示表情符号,除了带有问号的方形框,表示没有图像。所以我找到了上面的链接。我如何与这个沟通。我有我的 js 文件。
-(void)imageToTextViewForHome:(id)sender
{
UIButton *refrenceButtonForHome;
refrenceButtonForHome = sender;
int tag = refrenceButtonForHome.tag;
NSLog(@"tag...%d",tag);
NSString *imageNameToPass = [NSString stringWithFormat:@"%@",[emoticonsArrayForHomeEmoji
objectAtIndex:tag]];
NSString *path =[[NSBundle mainBundle] pathForResource:imageNameToPass ofType:@"png"];
NSLog(@"pathForImage..%@",path);
[webViewForEditing stringByEvaluatingJavaScriptFromString:[NSString
stringWithFormat:@"document.execCommand('insertImage', false, '%@')", path]];
}
【问题讨论】:
-
你想要完成什么?您可以使用他们的 unicode 表示来很好地使用表情符号。
-
@Eiko 我有一个 webview 接受 java 脚本返回的图像。而且我可以在文本之间的任何位置插入图像。这就是为什么我需要该代码将其转换为 .png 共振峰。
标签: javascript objective-c uiwebview