A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© zrtalent 高级黑马   /  2014-9-22 17:33  /  1988 人查看  /  2 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. - (void)viewDidLoad
  2. {
  3.     [super viewDidLoad];
  4.     [self.view setBackgroundColor:[UIColor whiteColor]];
  5.   
  6.     self.mapView = [[MAMapView alloc]initWithFrame:self.view.frame];
  7.     [self.view addSubview:self.mapView];
  8.     //长按屏幕,添加大头针
  9.     UILongPressGestureRecognizer *Lpress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(LongPressClick:)];
  10.     Lpress.delegate = self;
  11.     Lpress.minimumPressDuration = 1.0;//1.0秒响应方法
  12.      Lpress.allowableMovement = 50.0;
  13.     [self.mapView addGestureRecognizer:Lpress];
  14.    // [self cloudPlaceAroundSearch];
  15. }
复制代码
  1. //长按事件响应
  2. -(void)LongPressClick:(UILongPressGestureRecognizer *)gestureRecognizer
  3. {
  4.     //    if (gestureRecognizer.state == UIGestureRecognizerStateEnded)
  5.     //    {
  6.     //        return;
  7.     //    }
  8.    
  9.     //坐标转换
  10.     CGPoint touchPoint = [gestureRecognizer locationInView:self.mapView];
  11.     CLLocationCoordinate2D touchMapCoordinate = [self.mapView convertPoint:touchPoint toCoordinateFromView:self.mapView];
  12.     [self creatAnnotion:touchMapCoordinate];
  13.    
  14.    
  15. }
复制代码
这里这个手势方法-(void)LongPressClick:(UILongPressGestureRecognizer *)gestureRecognizer
怎么整都不执行,求大神帮我看看是哪里出了问题,谢谢。。

2 个回复

倒序浏览
你这也太快了吧!让大家望尘莫及啊
回复 使用道具 举报
单步一下,看看是否能调用方法。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马