开发者

Only displaying managed objects depending on an attribute

This is probably very basic but I am struggling.

I have an NSFetchedResultsController that gets managed objects from an entity I specify. The problem is I want to only display the managed objects that have a certain attribute in my table view.

- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];

cell.textLabel.text = [[managedObject valueForKey:@"title"] description];

So this is where the cells get assigned titles but I cant see how to o开发者_Go百科nly display certain managed objects.

Any help is appreciated.


Sounds like you need to construct a predicate to filter the objects you're retrieving. The Apple documentation has several useful snippets for doing things like this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜