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:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.