//接口继承自UITableViewController,需要实现这个方法获得每一部分有多少行 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of time zone names. return [timeZoneNames count]; }
// Try to retrieve from the table view a now-unused cell with the given identifier. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
// If no cell is available, create a new one using the given identifier. if (cell == nil) { // Use the default cell style. cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease]; }
/* To conform to Human Interface Guildelines, since selecting a row would have no effect (such as navigation), make sure that rows cannot be selected. 当对表格行进行选择时,禁止做选择动作。 */ - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath { return nil; }