您好我正在开发一个应用程序,在该应用程序中,我在屏幕上触摸图像,此时我会以这种方式执行此操作。
-(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];
}
在此处显示我的图像但是当NSTimer
被调用时图像变为闪烁或隐藏我需要图像直到触摸调用的-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
方法。
请建议我如何做这项工作。
答案 0 :(得分:0)
试试这个。
-(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];
}