Access Asset Catalog pathForResource

后端 未结 6 1305
滥情空心
滥情空心 2020-11-27 17:46

It appears that:

[[NSBundle mainBundle] pathForResource:@\"name\" ofType:@\"png\"];

Does not return anything for assets that are inside the Ima

6条回答
  •  醉酒成梦
    2020-11-27 18:35

    [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.png", [[NSBundle mainBundle] resourcePath], imgName]];
    

    imgName: the name of Image set, not caring the true name of the image in Image set.

提交回复
热议问题