User Tools

Site Tools


ios-labs-s14:basics-tables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
ios-labs-s14:basics-tables [2014/02/17 10:48]
mbarboi
ios-labs-s14:basics-tables [2014/02/26 13:26]
mbarboi
Line 2: Line 2:
  
 An extremely common, and slightly more complex, view used to build interfaces. An extremely common, and slightly more complex, view used to build interfaces.
 +
 +{{ ios-labs-s14:​p2.png }}
  
 Displays a set of data in **cells**, which the developer sets the number of. Allows a user to scroll through cells vertically. ​ Displays a set of data in **cells**, which the developer sets the number of. Allows a user to scroll through cells vertically. ​
Line 10: Line 12:
  
 The delegate methods required by a UITableView:​ The delegate methods required by a UITableView:​
-  * (NSInteger) numberOfSectionsInTableView:​(UITableView *)tableView  +  * -(NSInteger) numberOfSectionsInTableView:​(UITableView *)tableView  
-  * (NSInteger) tableView:​(UITableView *)tableView numberOfRowsInSection:​(NSInteger)section ​+  * -(NSInteger) tableView:​(UITableView *)tableView numberOfRowsInSection:​(NSInteger)section ​
  
 Return integers to the table. Return integers to the table.
  
-  * (UITableViewCell *) tableView:​(UITableView *)tableView cellForRowAtIndexPath:​(NSIndexPath *)indexPath ​+  * -(UITableViewCell *) tableView:​(UITableView *)tableView cellForRowAtIndexPath:​(NSIndexPath *)indexPath ​
  
 Method receives a cell that is **dequeued** from memory (has been scrolled off the screen and is no longer visible) for editing. Method is called when the table needs to display a new cell. Developer must change the views within the cell to represent model information,​ commonly using //​indexPath.row//​ as an index into an array. Cell is returned at the end of the method, at which point the table loads it into memory and onto the screen. Method receives a cell that is **dequeued** from memory (has been scrolled off the screen and is no longer visible) for editing. Method is called when the table needs to display a new cell. Developer must change the views within the cell to represent model information,​ commonly using //​indexPath.row//​ as an index into an array. Cell is returned at the end of the method, at which point the table loads it into memory and onto the screen.
  
--(void)tableView:​(UITableView *)tableView didSelectRowAtIndexPath:​(NSIndexPath *)indexPath+Note that cells have a property called **reuse identifier**,​ a string used to identify types of cells in the case of multiple tables. Set this property using the **Attributes Inspector** of InterfaceBuilder,​ access it in the //​cellForRowAtIndexPath//​ method. 
 + 
 +  * -(void)tableView:​(UITableView *)tableView didSelectRowAtIndexPath:​(NSIndexPath *)indexPath
  
 Called when a user touches a cell. Includes the index of the touched cell in //​indexPath.row.// ​ Called when a user touches a cell. Includes the index of the touched cell in //​indexPath.row.// ​
ios-labs-s14/basics-tables.txt · Last modified: 2015/10/30 11:47 by mbarboi