更新:无法将NSDictionary传递给UITableViewCell textlabel

更新这个线程,因为我有一些其他的帮助解决了为什么我无法访问方法外的NSDictionarys值…

我正在把它弄错,于是在方法结束时调用了autorelease,所以当我在这个方法之外调用它的时候,我得到了各种各样的错误。

所以现在基本上我试图分配NSDictionarys值到UITableViewCell文本里面cellForRowAtIndexPath但是我得到这个错误

这里是我想如何分配它和输出在这一点上

// Configure the cell... if(indexPath.row <= [self.sectionLetters count]){ // NSObject *key = [self.sectionLetters objectAtIndex:indexPath.row]; NSString *value = [self.arraysByLetter objectForKey:[self.sectionLetters objectAtIndex:indexPath.row]]; NSLog(@"thingy %@", value); cell.textLabel.text = value; } return cell; 

.OUTPUT

 2011-09-23 10:25:01.343 Code[6796:207] thingy ( Honda, Honda, Honda, Honda, Honda, Honda, Honda ) 

不过,如果我注释掉//Cell.textLabel.text = value; 我得到这个输出

.output2

 2011-09-23 10:26:38.322 Code[6876:207] thingy ( Honda, Honda, Honda, Honda, Honda, Honda, Honda ) 2011-09-23 10:26:38.323 Code[6876:207] thingy ( Mazda, Mazda, Mitsubishi, Mitsubishi, Mitsubishi, Mitsubishi, Mitsubishi, Mitsubishi ) 2011-09-23 10:26:38.325 Code[6876:207] thingy ( Nissan, Nissan, Nissan, Nissan, Nissan, Nissan, Nissan ) 2011-09-23 10:26:38.326 Code[6876:207] thingy ( Toyota, Toyota, Toyota ) 

你知道吗,我想我知道这个问题,所以我要猜测。

因为你直接使用了ArrayByLetter,所以我不相信你正在碰到综合属性,而是支持variables。 你需要使用self.arraysByLetter(这将保留字典)。

至less,我一直在使用self.property,所​​以我不记得这是一个必要还是一个习惯。 给一个镜头。