我在我的UITableViewCell子類中有一個DotImageView的屬性。在cellForRowAtIndexPath中的UITableViewCell的子類中顯示UIImageView
@property (nonatomic, retain) IBOutlet UIImageView *DotImageView;
我嘗試cellForRowAtIndexPath方法中是這樣顯示的:
static NSString *TargetCellIdentifier = @"TargetDetailTableViewCellIdentifier";
TargetDetailTableViewCell *cell = (TargetDetailTableViewCell *)[tableView dequeueReusableCellWithIdentifier:TargetCellIdentifier];
if (cell == nil) {
UINib *nib = [UINib nibWithNibName:@"TargetDetailTableViewCell" bundle:nil];
[nib instantiateWithOwner:self options:nil];
cell = self.TargetCell;
self.TargetCell = nil;
}
NSUInteger row = [indexPath row];
NSInteger section = [indexPath section];
Target *aTarget = [targetDictionary objectForKey:[NSNumber numberWithInteger:section]];
if (row == 0) {
UIImage *dot;
if (aTarget.importance == high) {
dot = [UIImage imageNamed:@"dot_red.png"];
}
else {
dot = [UIImage imageNamed:@"dot_gray.png"];
}
UIImageView *variantImageView = [[UIImageView alloc] initWithImage:dot];
cell.DotImageView = variantImageView;
[variantImageView release];
return cell;
我沒有看到我的細胞的任何圖像。我的UITableViewCell的子類的其他標籤顯示。我用UIImageView丟失了什麼?我並不是非常熟悉它。謝謝。
cell.DotImageView它的創建?也許你忘了在xib – Edig 2012-02-02 16:16:54
中連接它,當你說:「我在我的UITableViewSubclass中有一個DotImageView的屬性」它是UITableViewCell?我認爲我們需要在cellForRowAtIndexPath方法中看到你的UITableViewCell聲明。 – TheRonin 2012-02-02 16:18:45
@Ernesto我檢查了筆尖,它看起來連接 – Crystal 2012-02-02 16:25:45