將子視圖添加到自我和/或添加到內容視圖之間有什麼區別?正確地繼承UITableViewCell?
子視圖添加到自
- (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) {
UIImage *img = [UIImage imageNamed:@」lol.jpg」];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
[self addSubview:imgView];
[imgView release];
return self;
}
子視圖添加到內容查看
- (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) {
UIImage *img = [UIImage imageNamed:@」lol.jpg」];
UIImageView *imgView = [[UIImageView alloc] initWithImage:img];
[self.contentView addSubview:imgView];
[imgView release];
return self;
}