Iphone 如何从NSArray获取名称

Iphone 如何从NSArray获取名称,iphone,objective-c,arrays,xcode,Iphone,Objective C,Arrays,Xcode,我请求搜索核心数据实体。它发现它们很好,但我想将单元格的文本设置为实体的name属性 我目前有这个功能,但我正在将对象本身设置为title,而不是name属性,如何解决这个问题 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Routine" inManagedObjectContext:

我请求搜索核心数据实体。它发现它们很好,但我想将单元格的文本设置为实体的
name
属性

我目前有这个功能,但我正在将对象本身设置为title,而不是name属性,如何解决这个问题

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Routine" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
self.routineArray = results;
[fetchRequest release];

cell.textLabel.text = [self.routineArray objectAtIndex:indexPath.row];
尝试:

编辑

如果您的
例程
实例位于
routineArray
中(我想是以该名称命名的):


很好,很有效。但是有没有一种方法可以做到这一点,这样我就可以实际检索
例程
对象?因此,我可以根据需要修改它们。如果您的
例程
实例存储在
routineArray
中,当然有。我会编辑。
cell.textLabel.text = [[self.routineArray objectAtIndex:indexPath.row] name];
// get the Routine instance
Routine *r = [self.routineArray objectAtIndex:indexPath.row];
// now you got your instance, set anything you want on r...
// ...
// and then set its name as the text for textLabel using previous instruction