Hey guys so I have this code here:
Code:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
float touchX = [touch locationInView:touch.view].x;
float touchY = [touch locationInView:touch.view].y;
if (touchX >= square1.center.x - 25 && touchX <= square1.center.x + 25 && touchY >= square1.center.y -25 && touchY <= square1.center.y +25){
if (square1.image == [UIImage imageNamed:@"edge1.png"])
(square1.image= [UIImage imageNamed:@"edge2.png"]);
else if (square1.image == [UIImage imageNamed:@"edge2.png"])
(square1.image= [UIImage imageNamed:@"edge3.png"]);
else if (square1.image == [UIImage imageNamed:@"edge3.png"])
(square1.image= [UIImage imageNamed:@"edge4.png"]);
else if (square1.image == [UIImage imageNamed:@"edge4.png"])
(square1.image= [UIImage imageNamed:@"edge1.png"]);
}
}
I have a grid with 64 UIImageView and well I don't want to have to write this 63 other times. How would I go about detecting the Current UIImageView I am touching and have that be able to be used? Thanks!