2011-02-08 132 views
0
- (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; 
} 

当我实例化这个类的对象并在数据源中分配 - 委托,那么它是相同的无论“样式”我使用的权利? (UITableViewCellStyleDefault等)继承UITableViewCell

回答

1

如果您需要的所有内容都添加到contentView中,并且您不使用textLabel,detailTextLabel等。 比起来是一样的,是的。你也可以通过你的需要风格

self = [initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; // The style is just an example...

所以,从外部给定的风格将被忽略。 ;-)