Hello, I am just curious about an efficient way of using a UIImageView that changes images frequently. I have read that the +imageNamed: method is good because it will cache the loaded image after the first time it is loaded.
Basically, I have a UIImageView object, and it switches between two different images. Should my object store two NSStrings with the paths to these objects, and then call:
Code:
if (setFirstImage)
[imageViewObject setImage:[UIImage imageNamed:string1]];
else
[imageViewObject setImage:[UIImage imageNamed:string2]];
Or is it more efficient to simply store the UIImage objects as instance variables inside of my UIImageView object, and then switch between them like so:
Code:
if (setFirstImage)
[imageViewObject setImage:firstImage];
else
[imageViewObject setImage:secondImage];
From what I understand, the first way would be better, because the imageViewObject would not need to store as much information about itself, but I haven't really found much information about UIImageViews, so any tips would be greatly appreciated!
Brian