Setting Text Wrapping and Cut Off Modes

Operating system requirements: iOS 5.0 or later.

Mobile device: iPad.

Description

This example describes setting of text wrapping and cut off. After starting the example the following operations are executed:

Source Code

Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Creating a Simple Data Grid section):

// Get default style
NuGridCellStyle *style = [proxyDatasource gridViewGetDefaultStyle:[contr gridView]];
// Set text wrapping and cut off mode
[style setLineBreakMode:UILineBreakModeMiddleTruncation];
// Get table data
NSMutableArray *data = [datasource data];
// Specify new values for table cells
for (int i=0; i < 5; i++) {
    for (int j=0; j < 5; j++) {
        [[data objectAtIndex:i] replaceObjectAtIndex:j withObject:@"abcd efghijklmnopqrstuvwxyz"];
    }
};
// Set text indent from table cell left border
[style setIndent:1];

After executing the example a new text value is set for table cells that does not fit one string, and the cut mode that replaces the number of characters that do not fit with dots in the middle of the text. The text indent from left cell border is also set:

Remove text indent in the cell and disable the cut mode that replaces the number of characters that do not fit with dots in the middle of the text:

[style removeLineBreakMode];
[style removeIndent];

After executing the example the text indent is removed, the number of characters that do not fit the cell is cut:

See also:

Examples of Component Use