How to lazy load?

只愿长相守 提交于 2019-12-06 07:50:16

Lazy load means 'loading on demand'. So you perform operation only when it is really necessary, and not beforehand. Say we have method:

-(void) init {
   self = [super init];

   mMyMemberArray = [self loadSomeDataToArray];
}

-(void)  tableView:didSelectRowAtIndexPath: {
   [someObject processData: mMyMemberArray];
}

This is not lazy loading cause we've loaded data beforehand. But this:

-(void)  tableView:didSelectRowAtIndexPath: {
   someObject processData: [self loadSomeDataToArray]];
}

is exactly lazy loading, cause you get data when you really need it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!