黑马程序员技术交流社区

标题: 高德地图添加手势问题 [打印本页]

作者: zrtalent    时间: 2014-9-22 17:33
标题: 高德地图添加手势问题
  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
怎么整都不执行,求大神帮我看看是哪里出了问题,谢谢。。

作者: 闫跃文    时间: 2014-9-22 21:27
你这也太快了吧!让大家望尘莫及啊
作者: cjfire    时间: 2014-9-22 22:29
单步一下,看看是否能调用方法。




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2