【发布时间】:2015-03-24 08:08:26
【问题描述】:
我从 NSUrlRequest 得到一个 java 脚本作为响应。我想在 UIWebView 中显示它,但是如何让这个 java 脚本开始工作呢?提前致谢。
请注意,这里我想在我的 java 脚本中显示一些按钮,用户可以点击该按钮来执行一些操作。以下是我的一些代码:
// get strContent as java script (respond from NSURLRequest)
// _myWebView is an instance of UIWebView
- (void) showWebContent:(NSString*)strContent {
[self loadWebViewContent:strContent];
}
- (void) loadWebViewContent:(NSString*)strContent {
NSMutableString *htmlString = [[NSMutableString alloc] init];
[htmlString appendFormat:@"<html> <body>"];
[htmlString appendFormat:@"%@",strContent];
[htmlString appendFormat:@"</body> </html>"];
[_webView loadHTMLString:htmlString baseURL:nil];
}
【问题讨论】:
标签: javascript ios objective-c uiwebview