[英]Time Profiler: Optimizing UIImageView alloc/init calls
Time Profiler says that statements like these are slowing my app down. Time Profiler表示,此类陈述使我的应用程序运行缓慢。 Is there a better way to write this so that my app runs faster?
有没有更好的方法编写此代码,以便我的应用运行更快?
background = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myfolder.png"] highlightedImage:[UIImage imageNamed:@"myfolderOFF.png"]];
Thanks 谢谢
I'm going to go ahead and answer my own question with a "you can't." 我将继续回答“不能”。
However if you have an issue like this you COULD try optimize using C 但是,如果您遇到这样的问题,可以尝试使用C进行优化
http://iphonedevelopment.blogspot.com/2008/04/root-of-all-evil-introduction-to.html http://iphonedevelopment.blogspot.com/2008/04/root-of-all-evil-introduction-to.html
somewhere i've read about "imageNamed:" is evil, but it causes not really performance slowdowns. 我读过某个有关“ imageNamed:”的地方是邪恶的,但实际上并不会导致性能下降。 there were mostly reports off odd bugs and crashes.
大部分报告都是关于奇怪的错误和崩溃的报告。 Try "imageWithContentsOfFile:"
尝试“ imageWithContentsOfFile:”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.