0
votes

I just just migrated my launch images to assets with Xcode 7. My app was not using assets before. Xcode created an image catalog with AppIcon set an another set called "Brand Assets" with all my default images and that work just great. But, now I want to access the launch image programmaticaly.

I tried [UIImage imageNamed:@"Brand Assets"] and it does not work

And here is what xcode generated as images

/var/mobile/Containers/Bundle/Application/.../my.app/Brand [email protected], /var/mobile/Containers/Bundle/Application/.../my.app/Brand Assets-700-Landscape@2x~ipad.png, /var/mobile/Containers/Bundle/Application/.../my.app/Brand Assets-700-Landscape~ipad.png, /var/mobile/Containers/Bundle/Application/.../my.app/Brand Assets-700-Portrait@2x~ipad.png, /var/mobile/Containers/Bundle/Application/.../my.app/Brand Assets-700-Portrait~ipad.png, /var/mobile/Containers/Bundle/Application/.../my.app/Brand [email protected],

I guess I can use [UIImage imageNamed:@"Brand [email protected]"] for iPhone or the other generated names for iPad Portrait or Landscape

Is there a more safe way to obtain the generated launch screen so I can use it in my code ?

Someone experimented this ?

Note: My app support ios7

Thanks

1
You need to specify the name of the image set, not the name of the asset. But you really shouldn't attempt to load a launch image using UIImage because the algorithm to load an image using imageNamed: doesn't match how launch image assets are setup.rmaddy
I need to use launch image to add an activity indicator while my data is downloading, what can I do then ?T Bone

1 Answers

1
votes

You need to use the open the Assets.xcassets to open the xcode assets & then you can use the name as follows:

enter image description here

Select the Assets.xcasssets from Project navigator,then all assets that you have added will be displayed, so in the example below you can use the asset as follows:

[UIImage imageNamed:@"report"]