iOS目前支持的手势识别(6种)
UITapGestureRecognizer(点按)
UIPinchGestureRecognizer(捏合,二指往內或往外拨动,平时经常用到的缩放 )
UIPanGestureRecognizer(拖动,慢速移动 )
UISwipeGestureRecognizer(轻扫,快速移动)
UIRotationGestureRecognizer(旋转 )
UILongPressGestureRecognizer(长按)
 
点按手势和慢速拖动手势简单使用
//ViewController.m文件

#import "ViewController.h"

@interface ViewController ()

@property (nonatomic,strong) UIButton *gesturesBtn;

@end

@implementation ViewController

@synthesize gesturesBtn=_gesturesBtn;

- (void)viewDidLoad {

[super viewDidLoad];

[self.view setBackgroundColor:[UIColor whiteColor]];

self.navigationItem.title=@"手势测试";

_gesturesBtn=[[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width*0.35, self.view.frame.size.height*0.4, self.view.frame.size.width*0.3, self.view.frame.size.height*0.1)];

[_gesturesBtn setBackgroundColor:[UIColor blueColor]];

[_gesturesBtn.layer setCornerRadius:5.0];

[_gesturesBtn.layer setBorderWidth:0.5];

[_gesturesBtn setTitle:@"GesturesTest" forState:UIControlStateNormal];

[_gesturesBtn setTintColor:[UIColor blackColor]];

//慢速滑动

UIPanGestureRecognizer *panLeft=[[UIPanGestureRecognizeralloc]initWithTarget:self action:@selector(panLeftAction:)];

[self.view addGestureRecognizer:panLeft];

//单击手势

UITapGestureRecognizer *tapGes=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];

//点按次数

[tapGes setNumberOfTapsRequired:1];

//点按手指数量

[tapGes setNumberOfTouchesRequired:1];

//把手势加到该按钮视图上

[_gesturesBtn addGestureRecognizer:tapGes];

[self.view addSubview:_gesturesBtn];

}

//慢速滑动手势响应事件

-(void)panLeftAction:(UISwipeGestureRecognizer *)sender{

UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"慢滑动"delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

[alert show];

}

//点按手势响应事件

-(void)tapAction:(UITapGestureRecognizer *)sender{

UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"提示" message:@"点按手势" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

[alert show];

}

@end

iOS,手势识别简单使用的更多相关文章

  1. iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)

    iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)       1.UIGestureRecognizer介绍 手势识别在iOS上非常重要,手势操作移动设备的重要特征,极大的增加 ...

  2. ios iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势)

    iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势) 转自容芳志大神的博客:http://www.cnblogs.com/stoic/archive/2013/02/27/2940 ...

  3. iOS上简单推送通知(Push Notification)的实现

    iOS上简单推送通知(Push Notification)的实现 根据这篇很好的教程(http://www.raywenderlich.com/3443/apple-push-notification ...

  4. iOS CAReplicatorLayer 简单动画

    代码地址如下:http://www.demodashi.com/demo/11601.html 写在最前面,最近在看学习的时候,偶然间发现一个没有用过的Layer,于是抽空研究了下,本来应该能提前记录 ...

  5. iOS之简单瀑布流的实现

    iOS之简单瀑布流的实现   前言 超简单的瀑布流实现,这里说一下笔者的思路,详细代码在这里. 实现思路 collectionView能实现各中吊炸天的布局,其精髓就在于UICollectionVie ...

  6. UIGestureRecognizer ios手势识别温习

    1.UIGestureRecognizer介绍 手势识别在iOS上非常重要,手势操作移动设备的重要特征,极大的增加了移动设备使用便捷性. iOS系统在3.2以后,为方便开发这使用一些常用的手势,提供了 ...

  7. 【转】iOS手势识别的详细使用(拖动,缩放,旋转,点击,手势依赖,自定义手势) -- 不错不错

    原文网址:http://blog.csdn.net/totogo2010/article/details/8615940 1.UIGestureRecognizer介绍 手势识别在iOS上非常重要,手 ...

  8. 介绍一些实用的IOS手势识别库 (COCOS2D)

    http://www.supersuraccoon-cocos2d.com/zh/2012/11/14/introduction-to-some-great-ios-gesture-recogniti ...

  9. ios label 简单的长按复制文本信息

    在iOS开发过程中,有时候会用到UILabel展示的内容,那么就设计到点击UILabel复制它上面展示的内容的功能,也就是Label长按复制功能.网上有很多种给Label添加长按复制功能的方法,这里我 ...

随机推荐

  1. C语言中的强符号与弱符号

    转自:http://blog.csdn.net/astrotycoon/article/details/8008629 一.概述 在C语言中,函数和初始化的全局变量(包括显示初始化为0)是强符号,未初 ...

  2. Python学习笔记(二)——HelloWorld

    一.交互式化环境下书写代码 二.使用文本编辑器编辑.py文件 1.建议,使用Nodepad++,好看,免费,度娘直接搜素即可. 2.编写代码 3.保存为.py结尾的文件 4.使用cmd,打开到文件所在 ...

  3. win10休眠选项在哪里设置?如何设置?

    本人以前安装的Win7也是碰到这个问题 http://www.jb51.net/os/win10/373383.html 查询.打开休眠命令 1.右键开始菜单,选择命令提示符(管理员) 或 win+R ...

  4. jquery取值

    1. 如何用jquery获取<input id="test" name="test" type="text"/>中输入的值?$( ...

  5. 所有的畅通工程[HDU1232][HDU1874][HDU1875][HDU1879]

    畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissio ...

  6. PHP生成验证码及单实例应用

    /* note: * this 指向当前对象本身 * self 指向当前类 * parent 指向父类 */ /* 验证码工具类 * @author pandancode * @date 20150- ...

  7. css中的四个不同的position设置

    <!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...

  8. /usr文件系统

    /usr文件系统  /usr 文件系统经常很大,因为所有程序安装在这里. /usr 里的所有文件一般来自Linux distribution:本地安装的程序和其他东西在/usr/local 下.这样可 ...

  9. marquee-:模拟弹幕

              marquee:基本已被弃用!!1 可以模拟弹幕效果           1.方向:direction             up  right   left  down     ...

  10. 20145205 《Java程序设计》第9周学习总结

    教材学习内容总结 第十六章 JDBC简介 撰写应用程序是利用通信协议对数据库进行指令交换,以进行数据的增删查找 JDBC目的:让Java程序设计人员在撰写数据库操作程序时可以有个统一的接口,无须依赖特 ...