It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                7年前关闭。
            
                    
我想使用UITouch移动铅笔图像吗?我想动铅笔,它会写我们想要的任何东西。

但是我无法移动和书写铅笔图像。

专家的任何提示都将受到欢迎。

最佳答案

使用以下方法:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

  UITouch *touch = [touches anyObject];
  CGPoint currentPoint = [touch locationInView:self];
  yourPencilImgView.center = [touch locationInView:self];
}




-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

  UITouch *touch = [touches anyObject];
  CGPoint currentPoint = [touch locationInView:self];
  yourPencilImgView.center  = currentPoint;
}

关于iphone - 如何使用UITouch移动铅笔图像? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14138948/

10-11 00:28