开发者

Is it correct to initialise a UITableViewCell using initWithCoder?

开发者 https://www.devze.com 2023-01-15 22:05 出处:网络
I am loading a UITableViewCell using, [[NSBundle mainBundle] loadNibNamed:@\"BlogCell\" owner:self options:nil];

I am loading a UITableViewCell using,

[[NSBundle mainBundle] loadNibNamed:@"BlogCell" owner:self options:nil];
cell = blogCell;
self.blogCell = nil;

where blogCell is an outlet to BlogCell.xib

The actual UITableViewCell is of type BlogCell which is a subclass of UITableViewCell.

In my BlogCell class I am using

-(id)initWithCoder:(NSCoder *)aDecoder {
  self = [super initWithCoder:aDecoder];

  //initialisation of some cell properties here

  return self;
}

Is this correct? Is this the way you would tackle initialisation of a cell loaded from a nib?

Thanks开发者_运维百科


That, or in awakeFromNib.

0

精彩评论

暂无评论...
验证码 换一张
取 消