0

This is how my Xcode project is structured.

This is how my Xcode project is structured.

To access the bs-better@2x.png file, I can use the following code:

UIImage *cellIcon = [UIImage imageNamed:@"bs-better"];

This already works. However, for readability sake, I would like it if there's a way to include the grouping path in the code, something like:

UIImage *cellIcon = [UIImage imageNamed:@"Assets/Icons/bs/bs-better"];

Is this possible?

bneely
  • 9,083
  • 4
  • 38
  • 46
hfz
  • 317
  • 2
  • 15

2 Answers2

1

Yes it is possible, for this you need to create physical directory rather then logical enter image description here

You have to add directory with "create folder references for any added folders" rather then "Create group for any added folders" so it will generate physical directory like "Example Directory" in below image, so it must be access by proper path.

enter image description here

Dipen Chudasama
  • 3,063
  • 21
  • 42
0
 UIImage *img = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bs-better" ofType:@"png"]];

This is the method to get files from bundle.

user2826529
  • 179
  • 2