Hi guys, I'm developing an iPhone app, and I need a little help. I created a button and I want when I click on to change an image's imageView by the button's one.
the image and button :
CGRect slot1Rect = CGRectMake(70, 90, 80, 110);
UIImageView *slot1 = [[UIImageView alloc] initWithFrame:slot1Rect];
[slot1 setImage:[UIImage imageNamed:@"carte_dos_rouge.png"]];
slot1.opaque = YES;
[self.view addSubview:slot1];
[slot1 release];
UIButton *carte1J1=[UIButton buttonWithType:UIButtonTypeCustom];
carte1J1.frame=CGRectMake(60, 240, 50, 73.0);
[carte1J1 setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@.png",[d getlist1:0]] ] forState:UIControlStateNormal] ;
[carte1J1 addTarget:self action:@selector (clicCarte1J1) forControlEvents:UIControlEventTouchUpOutside];
[self.view addSubview:carte1J1];
the action:
- (void)clicCarte1J1:(UIImageView *)slot1 {
[slot1 setImage:[UIImage imageNamed:@"K_spades.png"]]; }
My problem is when I click on carte1J1 nothing happens, I should have the K_spades.png image on the slot1 UIImageView.