how do i add html page in my iphone xcode project?
- “-webkit-overflow-scrolling: touch” breaks css 3d perspective
- Convert RTF File into HTML in Objective C
- Objective-C: How to replace HTML entities?
- is it possible to make “HTML to speech” same like “Text to speech”?
- Use video as a background in ionic/cordova for ios
- How to read image file at documents directory from ios webview
3 Solutions Collect From Internet About “how do i add html page in my iphone xcode project?”
simply create a blank file and rename it to html or add existing html file to the project.
the next step depends on how you wish to use the html file.
Say if you want to load a local file called page.html, first you add the file to project,and in the build phases of your project, and the page.html to
Copy Bundle Resources, and run this in your app, it writes the file to the
documents dictionary of your app/
NSString *Html = [[NSString alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"page" ofType:@"html"] encoding:NSUTF8StringEncoding error:NULL]; [Html writeToFile:[[self docPath]stringByAppendingPathComponent:@"page.html"] atomically:YES encoding:NSUTF8StringEncoding error:NULL]; [Html release];
and your webview should call this to load the file:
NSArray *docPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docPath = [docPaths objectAtIndex:0]; [myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[docPath stringByAppendingPathComponent:@"page.html"]]]];
and it’s done.
What you might be looking for is documentation and example code for the UIWebView class of UIKit.
You can use
UIWebView to show your html file like this
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:URLString]]; [webView loadRequest:request];
URLString contains is your file url.
- How to get unique id in iOS device?
- background Images on pageViewController overlap in reverse
- Open view controller when remote notification pressed
- Swift cannot test core data in Xcode tests?
- Why .pch file not available in swift?
- Swift – Extra Argument in call
- “no such module” on Xcode 7 beta 2
- iOS White point/white balance adjustment examples/suggestions
- iOS Storyboard Back Button
- provide simple method to get current speed (implementing speedometer)
- Drawing waveform with AVAssetReader
- Remove recent items in the Xcode's CheckOut window
- How do I get a reference to the app delegate in Swift?
- Xcode 6.3 code completion too slow
- How To Get Account Name From Contact Framework