iOS Objective C: Display RTF document

Jason TEPOORTEN picture Jason TEPOORTEN · Feb 29, 2012 · Viewed 7k times · Source

I want to show a RTF document in a view. This document will be developed in Microsoft Word and will contains images.

What is the best way to do this using standard routines provided?

I would really like sample code to load a RTF document from the bundle. Kind Regards, Jason

Answer

pmf picture pmf · Feb 29, 2012

UIWebView opens .rtf documents. Try something like

NSURL *rtfUrl = [[NSBundle mainBundle] URLForResource:@"MyFileName" withExtension:@"rtf"];
NSURLRequest *request = [NSURLRequest requestWithURL:rtfUrl];
[_webview loadRequest:request];

See the documentation for UIWebView file types.