//显示目标 双击显示当前用户坐标位置
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. (转)如何处理iOS中照片的方向

    如何处理iOS中照片的方向 31 May 2015 • 7 min. read • Comments 使用过iPhone或者iPad的朋友在拍照时不知是否遇到过这样的问题,将设备中的照片导出到Wind ...

  2. eclipse导入项目前面有感叹号

    1.项目上右击---build path---Config..----Libra----

  3. Spring Boot 框架@Temporal(TemporalType.DATE)

    使用spring boot框架开发项目时,遇到这样一个问题: 查询pgSQL数据库中表A中某date数据类型的列B,想得到YYYY-MM-DD格式的日期,结果返回的为时间戳(长整型数据). 解决办法: ...

  4. 浅谈Runloop

    RunLoop 是 iOS 和 OS X 开发中非常基础的一个概念,这篇文章将从 CFRunLoop 的源码入手,介绍 RunLoop 的概念以及底层实现原理.之后会介绍一下在 iOS 中,苹果是如何 ...

  5. sass编译

    sass编译 命令行编译 单文件转换命令 sass style.scss style.css 单文件监听命令 sass --watch style.scss:style.css 文件夹监听命令 sas ...

  6. MyEclipse优化-六步攻略

    1.首先是jsp的可视化页面 windows -> preferences->General-> Editors -> File Associations  在上方框内选择*. ...

  7. spring4.2.3+mybatis+spring-security配置文件

    1.web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=&qu ...

  8. qsort C++ VS2013 leetcode

    class Solution { private: static int compare(const void * a, const void * b) { return (*(int*)a - *( ...

  9. C#压缩图片——高质量压缩方式

    传入Bitmap对象,以及新图片的长宽(Bitmap.Size),这样生成的就是跟原图尺寸一致的低质量图片 public Bitmap GetImageThumb(Bitmap mg, Size ne ...

  10. 【转载】.NET模拟POST登录并保持登录状态

    好了,还是由于工作需要 要登录一个网站并且模拟点击下载某些东西 原理就是先对一个地址(地址是用户名和密码输入框所在的form的action对应的页面)进行POST提交用户名和密码(不考虑验证码,当然验 ...