1.just declare UIImageView as Global name as actionImage
2.Paste below code
UITouch *touch = [touches anyObject];
CGPoint touchPoint = [touch locationInView:self.view];
CGRect myImageRect = CGRectMake(touchPoint .x , touchPoint.y , 50.0f, 50.0f);
actionImage = [[UIImageView alloc] initWithFrame:myImageRect ];
actionImage.center = touchPoint;
[actionImage setImage:[UIImage imageNamed:@"red_circle.png"]];
actionImage.opaque = YES; // explicitly opaque for performance
[self.view addSubview:actionImage];
3.remove image on touch end
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[actionImage removeFromSuperview];
}
4.Wherever to call on next method just remove image view
[actionImage removeFromSuperview];
5.enjoy coding
0 comments:
Post a Comment