views:

87

answers:

1

Hello There!

Im getting the value of an attribute using NSEntityDescription.attributeName, like this:

NSEntityDescription *edCurrentRecord = [maListRecords objectAtIndex:indexPath.row];
UILabel *lblCell = [[UILabel alloc] initWithFrame:CGRectMake(5.0, 10.0, 280, 20.0)];
[lblCell setText:edCurrentRecord.name];

There is another way to do this using an NSString? like:

NSEntityDescription *edCurrentRecord = [maListRecords objectAtIndex:indexPath.row];
UILabel *lblCell = [[UILabel alloc] initWithFrame:CGRectMake(5.0, 10.0, 280, 20.0)];
[lblCell setText:[edCurrentRecord someOtherWay:@"usingThisString"]];

I looked in the documentation and didn't find an answer and couldn't imagine one too (im new to core data).

Anyone?

+2  A: 

What you're looking for is called Key-Value Coding. The someOtherWay: method is actually called valueForKey:.

Chuck
Thanks! Helped a lot!
Paulo Ferreira