views:

695

answers:

1

I need to programmically change the graphic for a custom button and I'm puzzled why the code below isn't working. I can uncomment the first line and hide the button, so the IBOutlet is connected. The variable cardString points to a valid image (0-51.jpg).

    //[c1 setHidden: YES];
   cardString = [NSString stringWithFormat:@"%d%s", cards[0],".jpg"];
   card = [UIImage imageNamed: cardString];
   [c1 setBackgroundImage:card forState:UIControlStateNormal];
   NSLog(cardString);
A: 

Never mind. Use setImage instead of setBackgroundImage

Alan