2 language app - img problem

Discussion in 'iOS Programming' started by MACloop, Nov 2, 2010.

  1. MACloop macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #1
    Hello,
    I have a very strange error in one of my apps and cannot understand why...

    I have one app which is built into two different targets - one german and one english. Everything is working alright except for the images. In the german version no images are displayed (f.i for buttons). All the other variables are set alright.

    I have added the pictures to the project and placed them all in an img dictionary, as I always do. If I use the english pics in the german version, everything is fine, but if I use the german pics (see the code below) no pictures are displayed. I have tried to create my buttons differently, I have tried to remove the images and add them again to the project, but nothing works so far. My code looks like this - in the "view did load" I use two different images and the choice is done depending on the version currently being built:

    Code:
    #ifdef DE_VERSION
    	[self.close_btn setImage:[UIImage imageNamed:@"close_german.png"] forState:UIControlStateNormal];
    	[self.do_btn setImage:[UIImage imageNamed:@"calculate_german.png"] forState:UIControlStateNormal];
    #else	
    	[self.close_btn setImage:[UIImage imageNamed:@"close.png"] forState:UIControlStateNormal];
    	[self.do_btn setImage:[UIImage imageNamed:@"calculate.png"] forState:UIControlStateNormal];
    #endif	

    Does any one have any idea what might be wrong here? I do not know what to look for?

    Thanks in advance!
    MACloop
     
  2. MACloop thread starter macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #2
    worth to mention:
    If I use the german pics in the enhlish version - it works fine...this is very odd I think...?
    MACloop
     
  3. MACloop thread starter macrumors 6502

    Joined:
    May 18, 2009
    Location:
    Germany
    #3
    OK, I found out how to solve this. The clue is - I added images to the project after I did create the new target. This lead to the copy of the resources (img, xib etc) in the new target, which did not include the new images. If you have duplicated a target and then add new images to the project, you have to add those images to the copy bundle resources directory.
    /MACloop
     

Share This Page