Best way of loading images from application bundle

前端 未结 4 776
既然无缘
既然无缘 2021-02-07 09:20

What is the best way of loading images from the application main bundle. I am using

[UIImage imageNamed: \"image.png\"];

But I have heard that

4条回答
  •  长发绾君心
    2021-02-07 10:00

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"myimage" ofType:@"png"];
    UIImage *image = [UIImage imageWithContentsOfFile:filePath];
    

提交回复
热议问题