我在UITableView Cell中添加了UIImageView,但它不可見。 但是,當你選擇了行,圖像是可見的,它是如此困惑。 你能幫助我嗎?UIImageView在UITableViewCell中不可見
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier: (NSString *) reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
cellImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"one.png"]];
cellImage.frame = CGRectMake(240, 0, 20, 20);
[self.contentView addSubview:cellImage];
self.textLabel.text = @"parent";
}
return self;
}
它的工作原理,謝謝。 – haibarahu