itchy peachy
itchy peachy

Reputation: 1

Add a Webview Window to a existent iOS App that loads local stored HTML

Add a Webview Window to a existent iOS App that loads local stored HTML ... i am working on a app that loads a feed RSS and thats already done, but now the app needs a section that can be updated on a simple manner...

Upvotes: 0

Views: 116

Answers (1)

Simon
Simon

Reputation: 1394

Your going to want to just drop a webview on in your xib, attatch it through your IBOutlet property, and then load your local stored HTML like the following:

NSError *fileReadError = nil;
            NSString *filePath = [[NSBundle mainBundle] pathForResource:@"HTMLFilename" ofType:@"html"];
            NSString *fileContents = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:&fileReadError];

            if ( fileContents != nil )
            {
                [self.webView loadHTMLString:fileContents baseURL:nil];
            }

Upvotes: 1

Related Questions