//显示目标 双击显示当前用户坐标位置
UIButton * btnShowDistination = [[UIButton alloc]initWithFrame:CGRectMake(, SCREEN_HEIGHT--, , )];
[btnShowDistination setBackgroundImage:[UIImage imageNamed:@"show_distination"] forState:UIControlStateNormal];
[btnShowDistination addTarget:self action:@selector(btnTouchOne:forEvent:) forControlEvents:UIControlEventTouchDown]; [btnShowDistination addTarget:self action:@selector(buttonRepeatAction:) forControlEvents:UIControlEventTouchDownRepeat]; [self.view addSubview:btnShowDistination]; } - (void)btnTouchOne:(UIButton *)sender forEvent:(UIEvent *)event
{
[self performSelector:@selector(showDistination:) withObject:sender afterDelay:0.3];
} - (void)buttonRepeatAction:(UIButton *)sender{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(showDistination:) object:sender];
[self showsUserLocation:sender];
} - (void)showsUserLocation:(UIButton *)sender
{
if (_mapView.userLocation) {
[_mapView setCenterCoordinate:_mapView.userLocation.coordinate animated:YES];
_mapView.zoomLevel = ;
}
} - (void)showDistination:(UIButton *)sender{ if (_circle) {
[_mapView setCenterCoordinate:_circle.coordinate animated:NO];
_mapView.zoomLevel = ;
} }

iOS UIButton单双击处理响应不同的方法的更多相关文章

  1. iOS——UIButton响应传参数

    - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; 方法是 ...

  2. IOS开发之关于UIButton点击没有响应问题

    1.如果一个UIButton的frame超出父视图的frame,UIButton还是可以显现的,但响应不了点击事件了,当开发中,遇到UIButton点击没有响应问题时,我们需要输出btn及它父视图的f ...

  3. IOS UIButton用法详解

    这段代码动态的创建了一个UIButton,并且把相关常用的属性都列举了.希望对大家有用.   //这里创建一个圆角矩形的按钮UIButton *button1 = [UIButton buttonWi ...

  4. iOS UIButton 图片文字上下垂直布局 解决方案

    实现如图所示效果: 这是一个UIButton,需要改变image和title相对位置. 解决如下: //设置文字偏移:向下偏移图片高度+向左偏移图片宽度 (偏移量是根据[图片]大小来的,这点是关键)b ...

  5. iOS - 单例传值 (一)

    点击打开链接    iOS - 单例传值 (二) 单例只会对某个类实例化一次/单例类,对单例这个类实例化一次有且仅有一个对象 你单例初始化,只能初始化一次,然后你指向的对象,其实都是指向一个内存地址, ...

  6. [iOS]封装单例类

    [iOS]封装单例类 今天在学习iOS的SQLite开发,发现在需要使用SQLite的每个视图中,都需要对数据库进行打开或关闭,觉得挺麻烦的:于是在想能否写个单例类对这些操作进行封(因以前一直在使用D ...

  7. iOS登录单例

    iOS登录单例 一,工程图. 二,代码. UserInfo.h #import <Foundation/Foundation.h> @interface UserInfo : NSObje ...

  8. JQuery如何实现双击事件时不触发单击事件,解决鼠标单双击冲突问题

    在jQuery的事件绑定中,如果元素同时绑定了单击事件(click)和双击事件(dblclick),那么执行单击事件(click)时,不会触发双击事件(dblclick), 执行双击事件(dblcli ...

  9. WinForm中DataGridView的使用(四) - 区分单双击事件

    虽然DataGridView单双击事件都有,但双击事件其实也会触发单击事件的处理,所以如果双击事件和单击事件的行为不同,或者双击时不想触发单击事件,或者单击事件会阻塞双击事件的处理时(比如单击后会有弹 ...

随机推荐

  1. UILabel加载HTML

    NSString *string1 = @"<font color = \"red\">什么情况</font><br/>"; ...

  2. Mongodb在Windows 7下的安装及配置

    第一步 下载MongoDB: 下载mongodb的windows版本,有32位和64位版本,根据操作系统情况下载,下载地址:http://www.mongodb.org/downloads 解压缩至指 ...

  3. OpenStack虚拟机DHCP获取不到IP地址排查

    版本:OpenStack Liberty Neutron DVR 现象: 1.在虚拟机内部不停地dhclient 2.在虚拟机所属的计算节点的物理网卡上抓包,发现该虚拟机发出的dhcp广播包 3.在虚 ...

  4. 【css】a标签的用法

    <a>标签属性display的不同设置达到目的 display:block和display:inline; display:block 可以使得<a>标签设置宽高.边线.mar ...

  5. SDWebImageManager.m:244:22: Too many arguments to function call, expected 0,have 5

    SDWebImageManager.m:244:22: Too many arguments to function call, expected 0,have 5选中项目 Build Setting ...

  6. myeclipse中的weblogic 服务未正常关闭问题解决。

    myeclipse中的weblogic 服务若未正常关闭,直接启动服务会出现weblogic服务被锁. 正确操作:应该将相应的服务关掉然后重启 打开任务管理器,进入进程找到javaw,将进程结束.然后 ...

  7. ASCII电脑编码

    Bin Dec Hex 缩写/字符 解释 0000 0000 0 00 NUL(null) 空字符 0000 0001 1 01 SOH(start of headline) 标题开始 0000 00 ...

  8. listview的用法

    带标题和内容的 private String[] mtitle={"姓名","年龄","生日",};private String[] mar ...

  9. CSS实现垂直居中的5种方法

    利用 CSS 来实现对象的垂直居中有许多不同的方法,比较难的是选择那个正确的方法.我下面说明一下我看到的好的方法和怎么来创建一个好的居中网站. 使用 CSS 实现垂直居中并不容易.有些方法在一些浏览器 ...

  10. 数论 UVALive 2911

    这道题是一道数论题. 题目的意思是告诉m.p.a.b,并且告诉你xi满足的两个条件.让你求出 xp1 + xp2 +...+ xpm 的最大值(其中p<=12,切p是偶数). 这里需要对于xi所 ...