I am attempting to read the plist dictionary below into cells of a UITableView. I want to create a subview for each of the strings contained in the array denoted by the ArrayKey like:
Row1: | myString1 |
Row2: | myString2 || myString3 |
I've used fast enumeration to read the dictionary, but I can only successfully read the first string in each array:
CGFloat constant = 0;
for (NSArray key in [dictionary objectForKey:@"ArrayKey"]) {
UILabel *label = (UILabel *)cell;
label.text = (NSString *)key;
label.frame = CGRectMake(0 + constant, 0, 30, 30);
constant = 20 + CGRectGetMaxX(label.frame);
}
I'm missing the subview piece. And I'm puzzled why if I add an NSLog of the fast enumeration, the output will show all strings in the array, but I can only display the first (ie myString1 in one row and myString2 in a second row without myString3).
<dict>
<key>TitleKey</key>
<string>myTitle1</string>
<key>ArrayKey</key>
<array>
<string>myString1</string>
</array>
</dict>
<dict>
<key>TitleKey</key>
<string>myTitle2</string>
<key>ArrayKey</key>
<array>
<string>myString2</string>
<string>myString3</string>
</array>
</dict>