5/22/2009

UIImage cache or not to cache

There are different ways to display images. Cached or not cached. Apple employee at the forum said NOT to use the cache way, which is the + (UIImage *)imageNamed:(NSString *)name method in UIImage.
UIImageで絵をロードする時はキャッシュするやり方、 (UIImage *)imageNamed:(NSString *)name 、よりしないやり方のほうがいいらしい。

NSString *aFilePath = [[NSBundle mainBundle] pathForResource:@"mypicture" ofType:@"png"];
UIImage *aImage = [UIImage imageWithContentsOfFile:aFilePath];
UIImageView *aImageView = [[UIImageView alloc] initWithImage:aImage];

No comments:

Post a Comment