IPhone: How to wrap text in drawRect?

How to make wrapped text in drawRect method? I am trying to use the atebits class ABTableViewCell to create a custom drawing of a table view cell. I would like to draw a small picture, and then the text next to it, which may or may not be needed to wrap the line. Think of table cells in a Twitter client, such as Tweetie, that display a profile picture and a tweet. How it's done?

I tried using various NSString drawAtPoint methods, but they don't seem to wrap text on multiple lines.

+4
source share
1 answer

I think you need one of the drawInRect:withFont: methods. They are documented as performing word wrap. If you think about it, it makes sense that drawAtPoint will not work because it does not know the rectangle into which the text should fit.

+4
source

All Articles