Creating a Custom Bundle package

Source: Internet
Author: User

When we use a third-party framework, we often see xxx.bundle files. We find the file, show the package content, and see a lot of resource files: Pictures, configuration text, xib files ... What is a bundle file? A simple understanding is a resource file package. We organize many pictures, XIB and text files together and package them into a bundle file. facilitates referencing resources within packages in other projects. What are the characteristics of bundle files? The bundle is static, that is, the resource file that we include into the package is not compiled as a resource bundle without participating in the project. It also means that the bundle package cannot contain executable files. It is only as a resource and is parsed into a specific 2 binary data. So how do you create a custom bundle using the simplest method?

1 Create a folder

2 Add pictures to the folder, these images are used as resources , not compiled


3 Rename the folder to A.bundle

4 Drag the A.bundle into Xcode

recommendation : Do not use the system bundle package, because the deletion of resources is not very convenient

picture Gets the resources in the bundle, where the picture is automatically adapted (@2x, @3x)

Uiimageview *imgview=[[uiimageview Alloc] Initwithframe:cgrectmake (50, 50, 50,50)];

UIImage *image = [UIImage imagenamed:@ "mybundle.bundle/img_collect_success"];

[Imgview Setimage:image];

Eg: like the bundle resource in Svprogresshud, we can replace the picture in it, set it to the picture we want

Creating a Custom Bundle package

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.