I didn’t notice much performance lost by doing this. So I wonder if it doesn’t hurt when I re-use the same UIImage multiple times at the same time inside multiple UIImageViews?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
OK, I haven’t profiled this, but… It shouldn’t consume more memory. When you use a UIImageView, what happens is the CALayer that provides the visual appearance of all UIView subclasses on the iPhone, has it’s content property set to a CGImage object. When you set up multiple UIImageView objects with the same image, Cocoa Touch is smart enough to use the same CGImage as the content property for each UIImageView’s CALayer.
You do have multiple UIImageViews and each has it’s own CALayer, but when a CALayer is just displaying an unchanging image (one loaded from a file or URL), it’s a very lightweight object.