黑马程序员技术交流社区
标题:
高德地图添加手势问题
[打印本页]
作者:
zrtalent
时间:
2014-9-22 17:33
标题:
高德地图添加手势问题
- (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
怎么整都不执行,求大神帮我看看是哪里出了问题,谢谢。。
作者:
闫跃文
时间:
2014-9-22 21:27
你这也太快了吧!让大家望尘莫及啊
作者:
cjfire
时间:
2014-9-22 22:29
单步一下,看看是否能调用方法。
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2