Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in iPhone app appear in Simulator, but not when compiled to device

I am learning iPhone development, and have built a simple app that has an image that changes to another image when you tap it.

If i build it to the simulator, it works fine, but if i build it to the device the images dont appear. i feel like they aren't being copied across. I have checked they have been named correctly and i have made sure i imported them to 'resources'

I dont think it is a problem with the code because i added a thing to also make text appear when the image is tapped, and this works, so a button is still there doing something, it just doesn't have an image on it.

-(IBAction)changeImage:(id)sender { 
[fortuneCookieButton setImage:[UIImage imageNamed:@"Image2.jpg"] forState:UIControlStateNormal]; 
label.hidden = NO; 
}

 -(IBAction)restoreImage:(id)sender { 
[fortuneCookieButton setImage:[UIImage imageNamed:@"Image1.jpg"] forState:UIControlStateNormal]; 
label.hidden = YES; 
}
like image 324
lavelle Avatar asked Dec 06 '22 01:12

lavelle


2 Answers

Does the case (upper/lower) of all your file names match exactly for all letters? Source code & project & Mac?

like image 128
hotpaw2 Avatar answered Dec 11 '22 09:12

hotpaw2


just to share with you, I had this same problem and I found out the solution: I was using lower case in the file name and upper case in code. The thing is on Simulator there was no problem because Mac file system is case-insensitive but in the iPad it didn't work because iOS file system is case sensitive. ;-)

like image 23
Paulo Eduardo Jardim Avatar answered Dec 11 '22 08:12

Paulo Eduardo Jardim