开发者

Loading HTML into a Cocoa app with WebView and change text

Right, so far I've got this for loading up a HTML file from within my app:

NSString *path1 = [[NSBundle mainBundle] pathForResource:@"file" ofType:@"html"];
NSString *html = [NSString stringWithContentsOfFile:path1 encoding:NSUTF8StringEncoding error:nil];
[[webView m开发者_C百科ainFrame] loadHTMLString:html baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]bundlePath]]];

Which works loading the file up into the app's WebView. But I want to change some values in the HTML (or PHP if it works by using $_REQUEST/$_GET), for example, I have a table with some text in it and I want to change this text from an NSString etc.

How would I go about this?


You can execute JavaScript on UIWebView, if you need to do that dynamically. Or, if you want to refresh the whole page, you can modify string loaded from file according to your preferences.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜