viewWillAppear vs Viewdidload ios [英] viewWillAppear vs Viewdidload ios

查看:77
本文介绍了viewWillAppear vs Viewdidload ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用iOS导航应用程序的代码时,我遇到了麻烦:

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

在哪里可以为UITableView设置方法initdata?在viewWillAppear或viewDidLoad?

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

请帮帮我。

推荐答案

您可以根据应用程序的要求放置initData,

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
}

这篇关于viewWillAppear vs Viewdidload ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆