Search code examples
iosrtfnsattributedstring

RTF to NSAttributedString with Tables (iOS)


I'm using an RTF file as a template in an iOS App. A part of this is a couple tables; however, when doing the conversion from RTF to NSAttributedString, the tables are lost. If I sent them up as plain tabs, the formatting works. However, since most of the text in each of the cells in the table are multi-line, tabs don't work.

Is there a way to either convert the tables from RTF in NSAttributedString or create tables directly within an NSAttributedString?


Solution

  • So, having found no real support for tables on NSAttributedString for iOS from either HTML or RTF, my solution was to build the pages in HTML, load them into a UIWebView, instead of loading the NSAttributedString into a UITextView. This way I got the table formatting that I wanted and better yet, I had a view that I could use for creating PDFs of the document.