How to apply animation on image?
Hi I am developing a application in which where I touch on sc开发者_高级运维reen an image is shown at that point I am doing this in this way.
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *move = [[event allTouches] anyObject];
CGPoint MovePoint = [move locationInView:self.view];
appDelegate.FinalMovePoint=MovePoint;
timer =[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(Remaing) userInfo:nil repeats:YES];
[self showImageWithText:@"LongBlue" atPoint:appDelegate.FinalMovePoint];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.1];
imageView.alpha = 1.0;
[UIView commitAnimations];
}
In this my image is shown but when the NSTimer
is called image get blink or get hide I need the image until the touch the -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
method called.
Please suggest me how can I do this work.
Try this.
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *move = [[event allTouches] anyObject];
CGPoint MovePoint = [move locationInView:self.view];
appDelegate.FinalMovePoint=MovePoint;
timer =[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(Remaing) userInfo:nil repeats:YES];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.1];
imageView.alpha = 1.0;
[self showImageWithText:@"LongBlue" atPoint:appDelegate.FinalMovePoint];
[UIView commitAnimations];
}
精彩评论