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