UItextView在屏幕上移动时获取放大镜位置

时间:2014-08-04 06:54:41

标签: ios cocoa-touch ios7 uitextview

我有一个UITextView,里面没有任何文字。当我长按此视图时,放大镜出现在屏幕上,我可以用放大镜移动手指。问题是:当我移动放大镜时,有没有办法捕获这个手指动作以获得放大镜的位置?

谢谢,

enter image description here

1 个答案:

答案 0 :(得分:0)

我们可以用触摸方法做到这一点。

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
   NSLog(@"touchesBegan");
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
  [super touchesBegan:touches withEvent:event];
  NSLog(@"touchesMoved");
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
   NSLog(@"****touchesEnded");
   [self.nextResponder touchesEnded: touches withEvent:event];  
   NSLog(@"****touchesEnded");
   [super touchesEnded:touches withEvent:event];
   NSLog(@"****touchesEnded");
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
    [super touches... etc]; 
    NSLog(@"touchesCancelled");
}