开发者

How to apply animation on image?

开发者 https://www.devze.com 2023-04-12 23:52 出处:网络
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.

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];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号