As far as I know, there is no API provided by Apple to do what you want. You need to get the attributed text as an NSAttributedString from the UITextView and convert it to HTML. There are open-source projects for this however, for example DTCoreText. If you're not looking for very advanced features, you might also be able to build this yourself, just by looping through the string's characters and analyzing the style attributes.
EDIT: Actually, there is an API to do this now! You can use NSAttributedString's dataFromRange:documentAttributes:error:, passing NSHTMLTextDocumentType as the requested document type.
Cheers!
Example (in Swift, can be done similarly in Objective-C):
//Grab the attributed string, convert it to HTML data
let data = try self.textView.attributedText.dataFromRange(
NSMakeRange(0, self.textView.attributedText.length),
documentAttributes: [NSDocumentTypeDocumentAttribute : NSHTMLTextDocumentType]
)
//Convert the UTF-8 data to a string, display it in the text view
self.textView.attributedText = NSAttributedString(
string: NSString(data: data, encoding: NSUTF8StringEncoding)! as String
)