I am looking for a simple way to use NSAttributedString
with a very simple message box similar to:
NSString *new_item = [NSString stringWithFormat:@"<span style=\"font-family: Helvetica Neue; font-size: 12.0\">%@</span>", @"MOTD HTML String downloaded from website"];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[new_item dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MOTD"
message:attrStr
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
My above code takes a HTML formatted string that has been downloaded from a server, makes sure the text size will fit the screen properly, then tries to send the NSAttributedString
to the UIAlertView
. But UIAlertView
does not like this. what would be the simplest way around this problem?(Non HTML formatted MOTD is not an option)