View Html in ios / ipod apps

Hi, I want to make some http requests and generate html from my ipod application. I heard I want the WebView to view the html as if it were a browser. So my question is: how can I make an HTTP request? How to parse json (or xml) and how can I save / load data? I suppose I can use webstorage to load / save data, but I think, since it has an ipod application, do I have a better way to save it?

+3
source share
2 answers

Here's a snippet that loads the local html webpage contained in your application bundle:

UIWebView *webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
NSString *path = [[NSBundle mainBundle] pathForResource:@"mywebpage" ofType:@"html"];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:path]]];

-, , URL- localhost.

UIWebview HTML5.

+4

. iPod/iPhone/iPad; iOS7 iOS6.. ...

UIWebView *_webView = [[UIWebView alloc] initWithFrame:self.view.frame];
[self.view addSubview:_webView];

NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

[_webView loadRequest:request];
0

Source: https://habr.com/ru/post/1790091/


All Articles