Operating system requirements: iOS 5.0 or later.
Mobile device: iPad.
This example determines property values of the area containing dashboard objects, the number and types of embedded objects, and also displays visual view of this area.
Executing the example requires to place the following code in the body of the executeExample method of the ViewController class (see the Displaying of Dashboard section):
// Get dashboard controller MADashboardReportViewController *ctrl = (MADashboardReportViewController *)m_controller; // Get dashboard APKap *kap = [ctrl report]; // Get area containing dashboard objects APArea *area = [[[kap view] valueForKey:@"m_contentView"] valueForKeyPath:@"m_layout"]; NSLog(@"Index of table row: %d", [area row]); NSLog(@"Index of table column: %d", [area column]); NSLog(@"Number of table rows: %d", [area rowSpan]); NSLog(@"Number of table columns: %d", [area columnSpan]); NSLog(@"Number of embedded objects: %d", [[area objects] count]); // Get visual view of the area containing dashboard objects APAreaView *areaView = (APAreaView *)[area view]; NSLog(@"Number of table rows: %d", [[areaView area] rowSpan]); NSLog(@"Number of table columns: %d", [[areaView area] columnSpan]); // Get array of embedded objects NSMutableArray *objects = [[areaView area] objects]; // If the number of embedded objects is included into composite block, determine its name for(int i = 0; i < [objects count]; i++) { id object = [objects objectAtIndex:i]; if ([object isKindOfClass:[APCompositeBlock class]]) { NSLog(@"Composite block name: %@", [(APCompositeBlock *)object blockTitle]); } } // Set margins and size f the area containing dashboard objects [areaView setFrame:CGRectMake(50, 50, 650, 375)]; // Remove all window subviews NSArray *subviews = [self.view subviews]; for (UIView *subView in subviews) { [subView removeFromSuperview]; } // Display this area [self.view addSubview:areaView];
After executing the example the browser console displays property values of the area containing dashboard objects, the number and types of embedded objects:
Index of table row: 0
Index of table column: 0
Number of table rows: 1
Number of tale columns: 1
Number of embedded objects: 1
Number of table rows: 1
Number of tale columns: 1
Type of embedded object: APPanel
The considered area is displayed with the offset from the left top edge, width and height that are equal to 50, 650 and 375 pixels respectively:
See also: