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