Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

objective-c memory friendly way for background image

i have an ipad app (>30 views / pages) each view has a unique background.

the problem: whats the best way to set the background (memory friendly)

is there a better way than adding: uiimageview "backgroundView" as a subview?

version1:

[[UIImage alloc] initWithData:imageData];

which seems to be problematic with the retina switch

version2:

self.layer.contents = (id)image.CGImage;

version 3:

UIImage* image = [UIImage imageWithContentsOfFile:fileLocation];

version 2 seems to work fine. maybe someone tell me whats the best approach, and why ;)

thank you Alex

like image 288
Alex Milde Avatar asked Dec 05 '25 05:12

Alex Milde


1 Answers

CGImage is problematic with retina ... version3. is best for memory friendly !

like image 150
Dream.In.Code Avatar answered Dec 07 '25 19:12

Dream.In.Code



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!