zoukankan      html  css  js  c++  java
  • 手势

    http://blog.csdn.net/totogo2010/article/details/8615940

    UITapGestureRecognizer                 Tap(点一下)

    UIPinchGestureRecognizer              Pinch(二指往內或往外拨动,平时经常用到的缩放)

    UIRotationGestureRecognizer         Rotation(旋转)

    UISwipeGestureRecognizer             Swipe(滑动,快速移动)

    UIPanGestureRecognizer               Pan (拖移,慢速移动)

    UILongPressGestureRecognizer     LongPress(长按)

    自定义手势 TouchBegain

    出现冲突时,要设定优先识别顺序,目前只是doubleTap、swipe
    [singleTap requireGestureRecognizerToFail:doubleTap];
    [singleTap requireGestureRecognizerToFail:twoFingerTap];
    [pinch requireGestureRecognizerToFail:swipeRight];
    [pinch requireGestureRecognizerToFail:swipeLeft];

    向左移动

    UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(leftHandleSwipe:)];//声明和初始化手势识别器

    //对手势识别器进行属性设定
    [swipeLeft setNumberOfTouchesRequired:1];
        [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
    [self.view addGestureRecognizer:swipeLeft];//把手势识别器加到view中去

    单击
    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
    [self.view addGestureRecognizer:singleTap];

    双击

    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
    [doubleTap setNumberOfTapsRequired:2]; //点击的次数
    [self.view addGestureRecognizer:doubleTap];

    两个手指单击

    UITapGestureRecognizer *twoFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerTap:)];
    [twoFingerTap setNumberOfTouchesRequired:2];//手指的个数
    [self.view addGestureRecognizer:twoFingerTap];

    旋转

    UIRotationGestureRecognizer *rotation = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotation:)];
    [self.view addGestureRecognizer:rotation];

    缩放

    UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
    [self.view addGestureRecognizer:pinch];

    拖动

    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
    [self.view addGestureRecognizer:pan];

    长按

    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
    [self.view addGestureRecognizer:longPress];

    对应效果在各个方法中对应处理

    三、iphone操作手势的大概种类

    1.点击(Tap)
    点击作为最常用手势,用于按下或选择一个控件或条目(类似于普通的鼠标点击)、

    2.拖动(Drag)
    拖动用于实现一些页面的滚动,以及对控件的移动功能。

    3.滑动(Flick)
    滑动用于实现页面的快速滚动和翻页的功能。

    4.横扫(Swipe)
    横扫手势用于激活列表项的快捷操作菜单

    5.双击(Double Tap)
    双击放大并居中显示图片,或恢复原大小(如果当前已经放大)。同时,双击能够激活针对文字编辑菜单。

    6.放大(Pinch open)
    放大手势可以实现以下功能:打开订阅源,打开文章的详情。在照片查看的时候,放大手势也可实现放大图片的功能。

    7.缩小(Pinch close)
    缩小手势,可以实现与放大手势相反且对应的功能的功能:关闭订阅源退出到首页,关闭文章退出至索引页。在照片查看的时候,缩小手势也可实现缩小图片的功能。

    8.长按(Touch &Hold)
    在我的订阅页,长按订阅源将自动进入编辑模式,同时选中手指当前按下的订阅源。这时可直接拖动订阅源移动位置。
    针对文字长按,将出现放大镜辅助功能。松开后,则出现编辑菜单。
    针对图片长按,将出现编辑菜单。

    9.摇晃(Shake)
    摇晃手势,将出现撤销与重做菜单。主要是针对用户文本输入的。

  • 相关阅读:
    关于正则表达式的递归匹配问题
    给程序添加启动画面
    C#中的ICollection接口
    C#基本线程同步
    C# 图片裁剪代码
    .NET程序性能的基本要领
    C# 6与VB 12即将加入模式匹配
    Python实例---利用正则实现计算器[FTL版]
    Python实例---利用正则实现计算器[参考版]
    Python学习---重点模块之subprocess
  • 原文地址:https://www.cnblogs.com/feng-a/p/3777666.html
Copyright © 2011-2022 走看看