ViewWillAppear on UITableViewCell?

Bigair picture Bigair · Feb 9, 2016 · Viewed 9.7k times · Source

Is there any way to perform something like ViewWillAppear on UITableViewCell?

UITableViewDelegate methods (like willDisplayCell) only works when cells appear by scrolling.

In my situation, I need to detect cell appearance in a situation like user moves to another Tab and gets back to the UITableView.

I was able to solve the my problem using indexPathsForVisibleRows method but this doesn't seem to be a smart way of doing it.

Answer

Vvk picture Vvk · Feb 9, 2016

Yes. you have to use awakeFromNib meyhod inside the m file. this method is always call first.

-(void)awakeFromNib{

}

if visible cell not load then you have to reload your tableview.

 tableView.reloadData()

Hope it helps you.