Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

viewWillAppear vs Viewdidload ios

When code with iOS navigation application, I have facing with trouble this:

where can I put the method "initdata" for UITableView? in viewWillAppear or viewDidLoad?

please help me out.

like image 848
Clover03ti05 Avatar asked Jan 10 '12 11:01

Clover03ti05


1 Answers

You can put initData as per your requirement of the app,

if your table needs to load data every time with new Data then it should be under

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    //initData
}

Otherwise, if the table needs to be reload by a single Data which doesn't vary or there is not any editing operation performed on Data , you should use

- (void)viewDidLoad {
    [super viewDidLoad];
   //initData
}
like image 108
Ajay Sharma Avatar answered Oct 24 '22 17:10

Ajay Sharma