Can I use viewDidLoad method in UITableviewCell?

No you don’t write viewDidLoad in Custom cell class subclassing UITableViewCell(It;s part of UIViewController) .you have a method called

-(void)layoutSubviews
{
    [super layoutSubviews];
}

where in you can define frames and all for custom cell’s controls.Refer Apple’s UITableviewCell reference

Note however that ‘viewDidLoad’ is called only once in the lifetime of the object; it is rather like an initializer in general OO programming. However, ‘layoutSubviews’ will be called many times on each cell (depending on issues like scrolling and so on). It’s important to realize that for this reson many of the things you “usually do” in viewDidLoad, you can not do in layoutSubviews.

Note that viewDidLoad is called once only: layoutSubviews is called often.

It will just be a simple function if you write it.

Tutorial for custom cell

Leave a Comment