jodm
jodm

Reputation: 2617

Objective C - NSDictionary Question

Hi I am a newbie to objective C and was wondering how I could form an NSDictionary with the following structure.

level 1
    level attribute 1.1 - level score - level percent
    level attribute 1.2 - level score - level percent
    level attribute 1.3 - level score - level percent
level 2
    level attribute 2.1 - level score - level percent
    level attribute 2.2 - level score - level percent
    level attribute 2.3 - level score - level percent
level 3
    level attribute 3.1 - level score - level percent
    level attribute 3.2 - level score - level percent
    level attribute 3.3 - level score - level percent

Thanks in advance guys.

Upvotes: 0

Views: 245

Answers (1)

Dan Ray
Dan Ray

Reputation: 21903

That's an NSDictionary with three keys ("level 1", "level 2" and "level 3"). Looks like each field of that dictionary contains an array that has three values, each of which is an NSDictionary with the level attribute, score, and percent.

The thing to remember is that NSDictionary isn't BY ITSELF a nested structure. It's just a set of key-value pairs. But it can contain other objects as values, including NSArrays and NSDictionaries.

Upvotes: 2

Related Questions