//显示目标 双击显示当前用户坐标位置
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. Runtime Complexity of .NET Generic Collection

    Runtime Complexity of .NET Generic Collection   I had to implement some data structures for my compu ...

  2. CentOS 安装 Wine

    1. 下载安装包 Wine的中文官网可以下载到最新稳定和开发版本的Wine安装包,根据不同需求可以自行下载 2. 解压安装包,编译前检查 根据不同的平台选择不同的编译选项: For 32-Bit Sy ...

  3. [读书笔记]Java之静态分派

    以下内容来自周志明的<深入理解Java虚拟机>. 静态分派和重载有关. 先看代码: public static void main(String[] args) { SuperClass ...

  4. Log4j的简要概述

    读取配置文件的三种使用方式: 1.Java代码:BasicConfigurator.configure() 2.Java特性:键值对解析(properties文件) PropertyConfigura ...

  5. 用bugzilla统计BUG

    bugzilla—— reports—— Tabular reports—— 选择版本号啥的跟search一样 上面的行标Vertical Axis选Resolution:列标Horizontal A ...

  6. 素数方阵的工程ing

    2016 12 12 16 12 开始 2016 12 13 17 30   还没开打 2017 1 3 ..... 一星期前貌似打完了... 如下 #include<iostream> ...

  7. 以application/json 方式提交 然后用在php中读取原始数据流的方式获取 在json_encode

    html 如下: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>& ...

  8. js或jquery如何获取父级、子级、兄弟元素(包括祖级、孙级等)

    原生javascript方法: var a = document.getElementById("dom"); del_space(a); //清理空格 var b = a.chi ...

  9. job history 的查看

    linux shell 可以启动 mapred historyserver 然后根据显示的端口hostname+port进行访问(一般默认端口是19888)

  10. R包之间冲突带来的奇怪错误

    今天调试一个paper的代码,出现很奇怪的错误: qh2 <- mydf %>% filter(date >= as.Date('2013-08-14'),date <= as ...