views:

102

answers:

1

I'm trying to store an NSArray object with a simple key (1,2,3 etc.) inside an NSDictionary. I'm pretty sure thats worked, but I'm not sure how to display the array data thats stored in there, I've got the following working (displaying a single array of data)

The test app i'm working on is a simple dictionary. Definition is the class i've got for words and their definitions, and words is an array which has two values - word and definition

Definition *words = (Definition *)[appDelegate.words objectAtIndex:indexPath.row];

It then shows the data in a table view:

[cell.textLabel setText:words.name];
[cell.detailTextLabel setText: words.description];
A: 

Not quite sure what you're asking here. You create a Definition instance, so what properties does it have? If you have NSStrings name and description in it, then that code should work fine, but I think you're trying to do something different.

You access information in a NSDictionary by calling objectForKey: or valueForKey:.

You can also store information in the object. If you created your Definition to hold two strings--name and description, you could bypass the NSDictionary all together.

Could you post your Description.h so we can see what's going on?

MishieMoo