Tham khảo tài liệu 'phát triển ứng dụng cho iphone và ipad - part 25', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Generating Grouped Tables Using the NSFetchedResultsController 209 Here are the implementations for the numberOfSectionsInTableView and tableView numberOfRowsInSection methods O- NSInteger numberOfSectionsInTableView UITableView tableView return fetchedResultsController sections count Awiloblofor download on - NSInteger tableView UITableView tableView numberOfRowsInSection NSInteger section id NSFetchedResultsSectionInfo sectioninfo fetchedResultsController sections objectAtIndex section return sectioninfo numberOfObjects The tableView cellForRowAtIndexPath and tableView didSelectRowAtIndexPath methods are the same as in the RootViewController. You generate the cell text the same way and the behavior when a user selects a row is the same. The following is the code for the tableView cellForRowAtIndexPath and tableView didSelectRowAtIndexPath methods 0 Customize the appearance of table view cells. - UITableViewCell tableView UITableView tableView dnwadnadnn cellForRowAtindexPath NSIndexPath indexPath static NSString Cellidentifier Cell UITableViewCell cell tableView dequeueReusableCellWithIdentifier CellIdentifier if cell nil cell UITableViewCell alloc initWithStyle UITableViewCellStyleDefault reuseIdentifier CellIdentifier autorelease Configure the cell. Task managedTaskObject fetchedResultsController objectAtIndexPath indexPath Change the text color if the task is overdue if NSNumber numberWithBool YES UIColor redColor else UIColor blackColor return cell 210 I CHAPTER 7 BUILDING A CORE DATA APPLICATION - void tableView UITableView tableView didSelectRowAtIndexPath NSIndexPath indexPath Deselect the currently selected row according to the HIG tableView deselectRowAtIndexPath indexPath animated NO Navigation logic may go here -- for example create and push another view controller. Task managedObject .