November 2013
Intermediate to advanced
576 pages
19h 3m
English
After managed objects have been fetched, accessing and displaying data from them is straightforward. For any managed object, using the key-value approach will work to retrieve attribute values. As an example, refer to the configureCell:atIndexPath method in ICFFriendsViewController in the sample app. This code will populate the table cell’s text label and detail text label.
NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];cell.textLabel.text = [object valueForKey:@"friendName"];NSInteger numShares = [[object valueForKey:@"lentMovies"] count];NSString *subtitle = @"";switch (numShares){ case 0: subtitle = @"Not borrowing any movies."; break;
Read now
Unlock full access