A UIWebView can be used to display a variety of file types (ex: a.xls .key.zip .numbers.zip .pages.zip .pdf .ppt .doc .rtf .rtfd.zip .key .numbers and .pages).
I am working on a "How to use this application" part of my app and would like to find a good file type (stored locally) for displaying some text and images in a UIWebView.
The problem is lack of control over the final result. For example, text size seems to have no effect in either a .rtf or .doc file. I want to have a reasonable amount of control over the text and image properties. I could use a pdf, but I don't like the way the pdf's are framed, making everything that much smaller on the screen.
Does anyone have any experience displaying various file types in a UIWebView. What file type enables good creative control over the final result?
I would use good old html. It has great support in UIWebview (duh), and is relatively easy to learn and create.
Update:
To display a local file, from a UIViewController, use a process like this
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:self.view.frame];
[view loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"documentation" ofType:@"html"]]]];
while ([view isLoading]) {
// wait...
}
[self.view.addSubview:myWebView];
[view release];
Or, for a remote file:
UIWebView *myWebView = [[UIWebView alloc] initWithFrame:self.view.frame];
[view loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.myserver.com/ios/documentation/documentation.html"]]];
while ([view isLoading]) {
// wait...
}
[self.view.addSubview:myWebView];
[view release];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With