Subclassing UITableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
//My custom code for the view which I will add to the contentView
}
return self;
}
When I instantiate an object of this class and assign in the datasource - del开发者_如何学运维egate, then it is the same whatever "style" I am using right? (UITableViewCellStyleDefault etc.)
If you everything you need add in the contentView and you don't use textLabel, detailTextLabel ect. Than it is the same, yes. You could also pass your needed style in
self = [initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; // The style is just an example...
So the given style from outside will be ignored. ;-)
精彩评论