In the example, we are discussing about the setting of UITableViewCell to warp the text in multiple lines. Though you can do the setting directly through nib, but in the example we are doing it programatically.
UILineBreakMode is the property of UITableViewCell that is used to break the text or wrap the text in multiple lines. We are using the UILineBreakModeWordWrap property in the example.
List of other available UILineBreakMode properties:
- UILineBreakModeWordWrap = 0, // Wrap at word boundaries
- UILineBreakModeCharacterWrap, // Wrap at character boundaries
- UILineBreakModeClip, // Simply clip when it hits the end of the rect
- UILineBreakModeHeadTruncation, // Truncate at head of line: "...wxyz". Will truncate multiline text on first line
- UILineBreakModeTailTruncation, // Truncate at tail of line: "abcd...". Will truncate multiline text on last line
- UILineBreakModeMiddleTruncation, // Truncate middle of line: "ab...yz". Will truncate multiline text in the middle
a Simple Example:
// Customize the appearance of table view cells.
the Output is:
Posted on: September 28, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles