Imagenamed methods in iOS many pictures are taking up a lot of memory problems

Source: Internet
Author: User
We usually use [UIimage imagenamed:imagename] When we need to load a lot of pictures (photo albums);

actually [UIimage Imagenamed:imagename] This method will not be mutilated after the picture is used, the specific release time is determined by the system, this method is suitable for small pictures and some commonly used image processing.

when we do a simple picture browser we can not use this method, here is a simple approximate way to load the picture:
for (int i = 0; i<100; i++) {
NSString *imagename = [NSString stringwithformat:@ "img_%d", I];
NSString *path = [[NSBundle mainbundle] Pathforresource:imagename Oftype:nil];
UIImage *image = [UIImage Imagewithcontentsoffile:path];
}


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Imagenamed methods in iOS many pictures are taking up a lot of memory problems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.