我正在重新阅读UIApplicationMain文档,并想知道,如果UIApplicationMain永远不会返回,为什么:
return在结束了吗?NSAutoreleasePool吗?我甚至问自己:为什么int main(int argc, char *argv[])在iPhone上?我们可以使用命令行启动应用程序吗?什么是argc和argv为什么?它们是使用还是只是遗留C?
来自尊贵的研究员的推特上的一些评论是:
return 在这里为编译器NSAutoreleasePool是没用的.我想预先加载图像,当我将他们的UIImageView添加到我的currentView时,PNG已经在内存中,加载,充气等.
从这次时间分析中可以看出,图像在显示时会被加载:

与此同时,我之前已经预先加载了这些图像.就在我加载该视图时,我使用该代码彻底创建了这些动画的所有图像和图像视图:
- (UIImageView*)createAnimationForReel:(NSString*)reel ofType:(NSString*)type usingFrames:(NSInteger)frames{
UIImageView *imageView = [[UIImageView alloc] init];
NSMutableArray *imageArray = [NSMutableArray arrayWithCapacity:frames];
for (int i=0;i<frames;i++){
NSString *image;
if(i<10){
image = [NSString stringWithFormat:@"%@_0%i", reel, i];
} else {
image = [NSString stringWithFormat:@"%@_%i", reel, i];
}
NSString *path = [[NSBundle mainBundle] pathForResource:image ofType:@"png" inDirectory:type];
UIImage *anImage = [[UIImage alloc] initWithContentsOfFile:path];
[imageArray addObject:anImage];
}
imageView.animationImages = [NSArray arrayWithArray:imageArray];
imageView.animationDuration = 2.0;
return imageView;
}
Run Code Online (Sandbox Code Playgroud)
当我阅读文档时,它说:"此方法将图像数据加载到内存中并将其标记为可清除.如果数据被清除并需要重新加载,则图像对象将从指定路径再次加载该数据." 谈论initWithContentOfFile.所以我的图像"应该"被加载.
但不是.
当然,我的反思中缺少一些东西.但是什么?