Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example implements getting of table workspaces and displaying of their size in the development environment console. The console also displays values of availability of row and column filtering, sorting, docking of table to nearest row and column after scrolling, and value of table column width. After that cell coordinates are determined, and tale is scrolled to these coordinates.
Executing the example requires to place the following code instead of the executeExample method of the ViewController class (see the Creating a Simple Data Grid section):
-(void) executeExample{ // Display whether row and column fixation is available NSLog(@"%@ %hhd", @"Row and column fixation is available:", [[contr gridView] canFix]); // Display whether row and column fixation is available NSLog(@"%@ %hhd", @"Row and column sorting is available:", [[contr gridView] canSort]); // Display whether docking with nearest row and column is executed after table scrolling NSLog(@"%@ %hhd", @"Docking with nearest row and column after scrolling:", [[contr gridView] dockable]); // Get tha object used to execute various operations with table ViewController *viewController = [[contr gridView] actionDelegate]; // Display table column width value NSLog(@"%@ %f", @"Table column width value:", [viewController gridView:(NuGridView *)[contr gridView] widthForColumn:0]); }; // Handle table cell press event - (void)gridView:(NuGridView *)gridView wasTouchedInCell:(NuGridCell *)cell { // Display the whole table workspace size CGRect windowRect = [gridView windowRect]; NSLog(@"%@ (%f, %f)", @"Table workspace size:", windowRect.size.width, windowRect.size.height); // Display table workspace size without headers CGRect windowWithoutHRect = [gridView windowWithoutHeadersRect]; NSLog(@"%@ (%f, %f)", @"Table workspace size without headers:", windowWithoutHRect.size.width, windowWithoutHRect.size.height); // Display table workspace size without headers and fixed cells CGRect windowWithouHAndFixedRect = [gridView windowWithoutHeadersAndFixedCellsRect]; NSLog(@"%@ (%f, %f)", @"Table workspace size without headers and fixed cells:", windowWithouHAndFixedRect.size.width, windowWithouHAndFixedRect.size.height); // Determine cell coordinates NuGridPoint *point = [[NuGridPoint new] autorelease]; [point setRow:2]; [point setColumn:2]; // Scroll table to cell with specified coordinates [gridView showCellInPoint:point]; }
Press any table cell, after that the development environment console displays information about the table:
Fixation of rows and columns is available: 1
Sorting of rows and columns is available: 1
Docking with nearest row and column after scrolling: 1
Table column width value: 80.000000
Table workspace size: (768.000000, 1024.000000)
Table workspace size without headers: (688.000000, 974.000000)
Table workspace size without headers and fixed cells: (688.000000, 974.000000)
The table is also scrolled to the specified coordinates.
See also: