j'ai cette méthode code:UIImageView de tableau et tactile? pour IPhone
- (void)addImageSubViewAtX:(CGFloat)x atY:(CGFloat)y {
CGRect myImageRect1 = CGRectMake(x, y, 30.0f, 30.0f);
myImage1 = [[UIImageView alloc] initWithFrame:myImageRect1];
[myImage1 setImage:[UIImage imageNamed:@"status_finish.gif"]];
[self.view addSubview:myImage1];
}
maintenant j'utilise ce paramètre pour appeler les images code:
[self addImageSubViewAtX:160.0 atY:190.0];
et
[self addImageSubViewAtX:10.0 atY:190.0];
mais la méthode tactile fonctionne uniquement sur 1 image pas les deux
Code Promo:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint p = [touch locationInView:self.view];
if (CGRectContainsPoint(CGRectMake(myImage1.frame.origin.x, myImage1.frame.origin.y, myImage1.frame.size.width, myImage1.frame.size.height), p))
{
[pieMenu showInView:self.view atPoint:p];
}
}
comment faire cette touche de travail pour les deux
Vous auriez plus de chances d'obtenir des réponses si vous formiez votre code pour qu'il soit plus lisible. Regardez le guide de formatage. – jergason