【发布时间】:2010-12-10 13:36:27
【问题描述】:
我从一个包含两个字符串数组的字典的简单 plist 开始了这个项目。我现在想添加更多信息并想使用这个 plist 结构:
Root - Dictionary - (2 items)
Standard - Array - (3 items)
Item 0 - Dictionary - (4 items)
Color - String - Red
Rvalue - String - 255
Gvalue - String - 0
Bvalue - String - 0
很抱歉在 plist 中输入,但网站不允许我发布图片
我知道 RGB 值可能是数字而不是字符串,但我有理由让它们成为字符串。
这是我用来阅读简单plist的代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSString *key = [keys objectAtIndex:section];
NSArray *colorSection = [colors objectForKey:key];
static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier];
if(cell == nil){
cell=[[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier: SectionsTableIdentifier] autorelease];
}
cell.textLabel.text = [colorSection objectAtIndex:row];
[cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton]; //add disclosure button to rows
return cell;
}
我的问题是检索颜色字典的内容以获取 cell.textLabel.text 的颜色并读取 RGB 值以添加字幕的具体代码是什么。我已经为此工作了几天,并阅读了参考资料和大量示例,但不幸的是无法解决问题。非常感谢您的帮助。
【问题讨论】:
标签: iphone uitableview plist nsmutabledictionary