Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load app icon from xcassets

Tags:

I'd like to display the app icon inside my app. The icon is in the default assets catalog (Images.xcassets).

How do you load it? I tried the following and they all return nil:

image = [UIImage imageNamed:@"AppIcon"]; image = [UIImage imageNamed:@"icon"]; image = [UIImage imageNamed:@"icon-76"]; image = [UIImage imageNamed:@"icon-60"]; 

Other images in the assets catalog work as expected.

like image 226
hpique Avatar asked Oct 25 '13 10:10

hpique


1 Answers

By inspecting the bundle I found that the icon images were renamed as:

AppIcon76x76~ipad.png AppIcon76x76@2x~ipad.png [email protected] 

And so on.

Thus, using [UIImage imageNamed:@"AppIcon76x76"] or similar works.

Is this documented somewhere?

like image 148
hpique Avatar answered Oct 02 '22 16:10

hpique