Download presentation
Presentation is loading. Please wait.
Published byBenjamin Spencer Modified over 6 years ago
1
UITableView API A table view is an instance of the UITableView class. Created given... an area on the screen, and A table style. Rows are created using cells that are UITableViewCell objects. Two Protocols are used: Data Sourse: to provide data used to populate the table Delegate: to managing the appearance and behavior of the table (e.g., headers, footers, reorder cells)
2
Protocols used Remember: A protocol specifies a behavior through the inclusion of methods in the implementing object. UITableViewDataSource Protocol has two required methods: Number of rows in selection Cell for row at index path UITableViewDelegate Protocol Has no required methods.
3
Table Cells A Data Source method returns a cell object for a visible row. Cells can contain: an image or text content. The Table Cell object has methods that: manage cell selection, editing, accessory views, and cell configuration.
4
Table Uses Display graphics or text. Can be hierarchical.
Application based menu navigation. Usually hierarchical. View_iPhone/TableViewAndDataModel/TableViewAndDataModel.html
5
Example Download the DetailOverlayLayer.[h,m] files.
Import the .h file in both AsteroidsAppDelegate.m and AsteroidsLayer.h. In AsteroidsAppDelegate.m create the layer node and add it to the scene as a child (just like the AsteroidLayer). Hint: you might want to create a global to hold the DetailOverlaylayer *doLayer In AsteroidsLayer.m do a reloadData on the table in the step method so that the results of the step are redisplayed.
6
Try Adding Color In tableView:cellForRowAtIndexPath:
// Set the colors at the cells... // Create a background view for the cell UIView *bg = [[UIView alloc] initWithFrame:cell.frame]; bg.backgroundColor = [UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:1.0f]; cell.backgroundView = bg; [bg release]; // UILabel is subclassed from UIView so it just get's colored idx.backgroundColor = [UIColor colorWithRed:0.0f green:1.0f blue:0.0f alpha:1.0f];
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.