gpt4 book ai didi

javascript - 在 Objective C 中执行 js

转载 作者:行者123 更新时间:2023-11-28 02:38:48 25 4
gpt4 key购买 nike

我需要使用代码 http://code.kwint.in/emoji/source/ 进行通信。我已经编写了代码来将 iPhone 表情符号显示到网页 View (编辑器),但它不显示表情符号,除了带问号的方框,表明没有图像。所以我找到了上面的链接。我如何与此沟通。我有我的 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]];
}

最佳答案

Webview 可以运行 javascript,但我猜你无法直接返回某些内容。

看一下下面的示例:

http://will.thimbleby.net/script/

关于javascript - 在 Objective C 中执行 js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13006433/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com