如何在app中禁用缩放功能

iOS 码拜 9年前 (2015-05-05) 820次浏览 0个评论
 

RT,就是3个手指同时敲2下就可以缩放的zoom效果,在不改变系统设置那里的开关前提下,只在app游戏中不让出现这个效果  退出游戏了则恢复zoom效果,请问怎么做呢?

如何在app中禁用缩放功能
引用 1 楼 yetaodiao 的回复:

嗯?  请问怎么做呢  在uiview里

如何在app中禁用缩放功能
– (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      
}
– (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
   }
– (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   }
– (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
       
}
用这三个方法,截获“3个手指同时敲2下”操作。然后自己处理下

NSUInteger numTaps = [[touches anyObject] tapCount];//点了几下
    NSString *tapsMessage = [[NSString alloc]
                             initWithFormat:@”%d taps detected”, numTaps];
    tapsLabel.text = tapsMessage;
    [tapsMessage release];
    
    NSUInteger numTouches = [touches count];//几个触摸点
    NSString *touchMsg = [[NSString alloc] initWithFormat:
                          @”%d touches detected”, numTouches];
    touchesLabel.text = touchMsg;
    [touchMsg release];

如何在app中禁用缩放功能
引用 3 楼 lone_boy 的回复:

– (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      
}
– (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
   }
– (void)touchesEnded:(NSSet *)touches withE……

初学者  没看懂啥意思

如何在app中禁用缩放功能
40分

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

}
– (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
}
– (void)touchesEnded:(NSSet *)touches withE……

监听你对View的手指操作,比如几个手指,点了几下,都可以获取的。

如何在app中禁用缩放功能

没有吧?
放在UIScrollView 或者实现UIScrollViewDelegate才会缩放吧。

如何在app中禁用缩放功能
引用 3 楼 lone_boy 的回复:

– (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
      
}
– (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
   }
– (void)touchesEnded:(NSSet *)touches withE……

NSUInteger numTaps = [[touches anyObject] tapCount];//点了几下
NSUInteger numTouches = [touches count];//几个触摸点

这2句要写在哪里呢,我把这2句写在 touchesBegan里面  然后用if来判断,如果是缩放就return,貌似没有效果呢

如何在app中禁用缩放功能
貌似  NSUInteger numTouches = [touches count];//几个触摸点   总是得到1   什么情况呢
如何在app中禁用缩放功能
不行呢,看了developer.app.com  里面说上面那套API只是捕捉单个手指触屏的  3个手指就不行  所以能捕捉到连续拍了几下  但是捕捉不到是几个手指拍的……

求高人指点


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明如何在app中禁用缩放功能
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!