2011-09-21 76 views
2

我不...已了解我成功地填充我的表视图,但是当我把它的滚动崩溃而无消息..当我滚动我的tableview崩溃

创建我tabQuestionNSMutablearray,然后在添加此我代表:cellForRowAtIndexPath

NSDictionary *question = [self.tabQuestion objectAtIndex:indexPath.row]; 

[cell setAccessoryType: UITableViewCellAccessoryDisclosureIndicator]; 

cell.textLabel.text = [NSString stringWithFormat:@"%@", [question objectForKey:@"question"]]; 
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", [question objectForKey:@"reponse"]]; 

if ([[question objectForKey:@"bOk"] isEqualToString:@"1"]) { 
     cell.imageView.image = [UIImage imageNamed:@"ok.png"]; 
} 
else 
{ 
     cell.imageView.image = [UIImage imageNamed:@"ok.png"]; 
} 

[question release]; 



return cell; 

回答

2

你不应该release对象通过的NSArray方法objectAtIndex:返回。这种情况非常罕见。

尝试删除首先行:[question release];

然后检查你的self.tabQuestion包含的对象要紧的量。

+0

如果我只添加这些行我有崩溃 - > NSLog(@“%@%i”,[tabQuestion description],indexPath.row); NSLog(@“%@”,[[self.tabQuestion objectAtIndex:indexPath.row] description]);索引(15)超出范围(0) –

+0

错误表示您的数组包含0个对象。 – Nekto

+0

我找到解决方案。实际上,系统会自动释放我的对象。我解决它与保留。 –