pathForResource? without using extension (Iphone)

后端 未结 5 1291
醉话见心
醉话见心 2020-12-31 04:22

Here is what I\'m doing, when I create an image with the path in the bundle:


UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathFo         


        
5条回答
  •  感情败类
    2020-12-31 05:20

    I found that with an extension of ".jpg" it was necessary to use ofType for the extension for the app to work on an iPod Touch, whereas with an extension of ".png" I could just put "image.png" in pathForResource and say ofType:nil. But all versions worked on the simulator.

    The app bundle contains the image file, and I am using:

    [[NSBundle mainBundle] pathForResource:@"Auto" ofType:@"jpg"]
    

    to get a path.

提交回复
热议问题