使用"viewDidLoad"我的viewController需要很多时间才能出现! [英] with "viewDidLoad" my viewController take much time to appear!

查看:108
本文介绍了使用"viewDidLoad"我的viewController需要很多时间才能出现!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我加载viewController时,我使用了"viewDidLoad"方法来初始化我的视图,但这需要花费很多时间才能使视图出现.因此,我想到了使用"viewDidAppear"方法来加速我的视图的外观,但是现在,每次我按我的视图(这是正常的)或弹出视图时,关于我的视图的信息的负载现在都被加载到内存中(这是我的问题) 你有主意吗?

when i load my viewController i used "viewDidLoad"method to init my view ,but this take much time to make the view appeared .So i had the idea to use "viewDidAppear" method to accelerate the appearance of my view but the load of the informations about my view are now loaded to the memory every time that i push my view (which is normal) or i pop to it(and there is my problem) Have you an idea?

推荐答案

我使用"ViewDidAppear:animated"方法完成了此操作,并且对于每次显示时都加载数据的问题,我在顶部进行了测试方法:

i did it with the method "ViewDidAppear:animated" and for the problem of loading data for every appearance i deal with it with a test on the top of the mehod:

if(data==nil){/*i do ...*/}

对我来说,数据是我在加载视图时写的一个数组

and for me data was an array that i am writing on when loading the view

这篇关于使用"viewDidLoad"我的viewController需要很多时间才能出现!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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