How to make an iOS asset bundle?

前端 未结 7 583
谎友^
谎友^ 2020-12-02 05:37

I saw a custom asset bundle in an iOS project I evaluated, so at least I know it\'s possible.

My issue is that I\'m using a CATiledLayer with about 22,000 tiles for

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 05:41

    Here's how I got this to work: In Xcode create a new file | Resource | Settings Bundle. Then in the Finder select that bundle and choose Show Package Contents, and add whatever image files.

    Then in the code reference an image this way:

    NSString *imgName = @"bundlename.bundle/my-image.png";
    UIImage *myImage = [UIImage imageNamed:imgName]; 
    

提交回复
热议问题