【发布时间】:2011-03-23 16:05:47
【问题描述】:
我有一个视图,它在 viewDidLoad 期间将 100 多个图像加载到屏幕上,如下所示:
cover = [[UIImageView alloc] initWithImage:[UIImage imageNamed:currentQuestion.image]];
cover.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:currentQuestion.image ofType:@"jpg"]];
cover.contentMode = UIViewContentModeScaleAspectFit;
cover.transform = CGAffineTransformMakeScale(0.1, 0.1);
cover.frame = CGRectMake(30, (current*70), 100, 100);
[scrollView2 addSubview:cover];
这需要一些时间来加载(5 秒以上),我记得知道您应该只在屏幕上加载您需要的内容,因此我更愿意加载前 10 个图像,允许加载视图,并且然后将剩余的图像添加到其他功能中,因为它们最初在屏幕外,直到用户向下滚动。最好的地方在哪里?我是否只是在 viewDidLoad 中调用另一个函数,例如 [self loadTheRest];或 [self performSelector:@selector(loadTheRest) withObject:nil afterDelay:0.3f]; ?
提前感谢您的帮助!
【问题讨论】:
标签: iphone image viewdidload