Works on iPhone Simulator but not on device

后端 未结 3 463
自闭症患者
自闭症患者 2020-12-19 07:40

Here I addsubviews (UIImageViews) it all works on the simulator but not on the device (iOS 4.1) wtf!?

- (void)addChips:(int)value {
UIImage *chipImage;
switc         


        
相关标签:
3条回答
  • 2020-12-19 08:02
    1. Make sure you write the correct file names, iOS is case sensitive, simulator is not.
    2. Make sure you have the proper retina files if you test on iPhone4
    0 讨论(0)
  • 2020-12-19 08:11

    You are going to use your image, names only. Not with image extension. You should use the full image name as

    [UIImage imageNamed:@"a.png"];
    

    Make sure image name is the be same as you stored it in the resource folder.

    0 讨论(0)
  • 2020-12-19 08:16

    I found the answer in the documentation:

    Case-sensitivity: iPhone OS uses a case-sensitive file system, unlike the Simulator which uses a case-insensitive file system by default. Make sure the case-sensitivity of resources accessed within code matches the filename case-sensitivity.

    For example, if our filename is "YourExampleImage.png":

    Good: [UIImage imageNamed:@"YourExampleImage.png"]

    Bad: [UIImage imageNamed:@"YourExampleImage.PNG"]

    Bad: [UIImage imageNamed:@"yourexampleimage.png"]

    So I just have to ensure my image names are the same case as my resources. So in my case I should of put 5Chip instead of 5chip.

    0 讨论(0)
提交回复
热议问题