iphone - Changing an Image on TouchesBegan -
hey, trying change image when user touches imageview. @ moment imageview has image "heart1.png" when touch imageviewer on screen change "heart2.png" code, appreciated:
-(void) touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [[event alltouches] anyobject]; cgpoint location = [touch locationinview:self.view]; if (location.x >= imageview.frame.origin.x && location.x <= imageview.frame.origin.x + imageview.frame.size.height && location.y >= imageview.frame.origin.y && location.y <= imageview.frame.origin.y + imageview.frame.size.height) { imageview.image = [uiimage imagenamed:@"heart2.png"]; } }
that looks problem me:
if (location.x >= imageview.frame.origin.x && location.x <= imageview.frame.origin.x + imageview.frame.size.--> height <--
should width there :)
Comments
Post a Comment