See Image in Images.xcassets

I have the following structure in my Images.xcassets in Xcode:

enter image description here

There is a typical method for setting an image using NSImage *image = [NSImage imageNamed:@"confused"]; but is there a way to set an image using a folder structure?

For example, I tried NSImage *image = [NSImage imageNamed:@"/Statusbar/confused"]; Link to the image in the Statusbar folder, but it doesnโ€™t work. This approach would be useful if you need to have different images with the same name, where each image is located in a different xcassets folder. And yes, Xcode allows you to name two images with the same name.

+6
source share
2 answers

No, It is Immpossible. If you want this feature to be added, please use the radar file . (I personally filed rdar: // 15347004, โ€œAdd the ability to analyze asset catalogs,โ€ for this problem - but the more radars, the more likely the problem will be noticed and fixed)

0
source

After much searching, there is no way, like frozendevil, for this, and the only possible way is to not use Images.xcassets at all and use the following method, as described here. Can I immediately view all the images in .xcassets?

0
source

Source: https://habr.com/ru/post/970837/


All Articles