2012-08-13 73 views
0

我刚刚在我的故事板中添加IBOutlet到我的UIImageView,现在我的自定义TableViewCell不再有效。添加IBOutlet并自定义TableViewCell不再工作

2012-08-13 13:30:28.052 Project[6189:fb03] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<TableViewController 0x808ab80> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key imageView.' 


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

static NSString *CellIdentifier = @"CustomCell"; 
static NSString *CellNib = @"CustomCell"; 

CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellNib owner:self options:nil]; 
    cell = (CustomCell *)[nib objectAtIndex:0]; 
} 
... 
} 

有什么建议吗?

回答

1

这是我的应用程序外观。我使用动态原型表和自定义单元格。

ss

我的故事板是像下面。

ss

的一点是,你应该设置如下图像视标签

ss

不要忘记设置相同与代码中的小区标识。代码如下:

UIImageView *imageView = (UIImageView *)[cell viewWithTag:5]; 
    imageView.image = [UIImage imageNamed:@"foo.jpg"]; 
+0

我的TableViewCell是自定义的。更高,10张标签,4张照片。 UILabel Outlets正在工作。 UIImageView不是。这是我的问题。 – jussi 2012-08-13 12:34:21

+0

对不起,我误解了你的情况。现在我展示了我的应用程序的一部分。我希望这对你有所帮助。 – weed 2012-08-13 12:37:50

+0

谢谢你的工作。 但我仍然不明白为什么我不能使用IBOutlet的UIImageView。这令人困惑 – jussi 2012-08-13 12:42:15