【问题标题】:UItextView get Magnifier position as it moves on the screenUItextView 在屏幕上移动时获取放大镜位置
【发布时间】:2014-09-26 14:26:51
【问题描述】:

我有一个 UITextView,其中不包含任何文本。当我长按这个视图时,放大镜出现在屏幕上,我可以用放大镜移动手指。问题是:当我在移动放大镜时,有没有什么办法可以捕捉到这个手指的动作来获得放大镜的位置?

谢谢,

【问题讨论】:

    标签: ios cocoa-touch ios7 uitextview


    【解决方案1】:

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

    - (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");
    }
    

    【讨论】:

    • 我之前确实试过这个。忘记提了。当放大镜在屏幕上时,这不起作用。移动放大镜时不会调用 TouchesMoved。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-25
    • 2017-06-17
    • 2011-10-28
    • 1970-01-01
    • 2011-11-08
    相关资源
    最近更新 更多