iOS Engineering and resource files and bundles

Source: Internet
Author: User

In a simple app, you may only use the project, but the larger the project, the more complex it will be, the need to split the project and separate the functions into each project.

You can use WORKSAPCE to manage project collections.

But resource files are poorly managed because Xcode can only add its own project, or sub-project resource files to target, by default.

If it is a lateral project, how to add it? You can use bundles

Bundle is a resource type in OS X, but is compatible with iOS

We can first create a bundle of OS X and then modify its compilation type to iOS

Adjust the base SDK to

then add the resource file (Png,xib,storyboard, etc.) to this bundle.

Although the resource file is packaged in bundles, the bundle cannot be added to the target of other project compilations

We need to change scheme

Edit scheme-"build-" ADD this bundle

This will automatically compile the bundle when the other target is compiled, but the bundle will not be packaged in the app.

We also need to add the run script to the build parses

Build parses-"Add Run script (dot + sign)

Cp-r-F $BUILT _products_dir/mybundlename.bundle $BUILT _products_dir/$CONTENTS _folder_path/

If there are multiple bundles

Cp-r-F $BUILT _products_dir/*.bundle $BUILT _products_dir/$CONTENTS _folder_path/

So bundles can be packaged into the app as usual.

You need to specify bundles when you use them.

[UIImage  imagenamed: @"Yourbundlefile.bundle/imageinbundle"];



Related Article

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.