Time Profiler: Optimizing UIImageView alloc/init calls
Time Profiler says that statements like these ar开发者_运维百科e slowing my app down. 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
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. there were mostly reports off odd bugs and crashes. Try "imageWithContentsOfFile:"
精彩评论