How does one draw wrappped text in the drawRect method? I’m trying to use atebits’ ABTableViewCell class to do custom drawing of a table view cell. I’d like to draw a small picture and then text next to it which may or may not need to line wrap. Think of the table cells in a Twitter client like Tweetie which show a profile picture and a tweet. How is that done?
I tried using the various NSString drawAtPoint methods, but they don’t seem to wrap the text into multiple lines.
I think you need one of the
drawInRect:withFont:methods. They are documented as performing word wrapping. If you think about it, it makes sense thatdrawAtPointwouldn’t work, because it doesn’t know the rectangle the text needs to fit into.