I was wondering if UITextView can display rich text? I want to have simple formatting on my read only text (like different alignment for different parts of the text). if not
Here is a code snippet for anyone trying to do this - use the uiwebview to handle styled text - getting your local js files to work can be trick. Just go into Build Phases -> Compile Sources -> and add the js files you want to access locally in your html content. You can also evaluate strings as javascript from objective c on your webview.
NSString *someHtmlContent = [NSString stringWithFormat:@"", dynamicText];
NSLog(@"HTML with code: \n%@", someHtmlContent);
NSString *resourcePath = [[[[NSBundle mainBundle] resourcePath]
stringByReplacingOccurrencesOfString:@"/" withString:@"//"]
stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
[MyWebView loadHTMLString:someHtmlContent baseURL:[NSURL URLWithString:
[NSString stringWithFormat:@"file:/%@//", resourcePath]]];
[self.MyWebView setDelegate:self];
Setting the delegate let's you decide how to handle links - do you want them to open in mobile safari or in your webview