0

その場所の周りにオーバーレイをドレーするために長押しした後、その場所を取得しようとしています。しかし、長押しで設定したアクションが発砲しません。

-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:YES];

//add the long press options

//single finger long press
UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(getMapCoordinateFromTouch:)];
[longPressGesture setNumberOfTouchesRequired:1];
longPressGesture.delegate = self;
[self.mapview addGestureRecognizer:longPressGesture];

//double finger long press
UILongPressGestureRecognizer *doubleLongPressGesture = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(removeBoundry:)];
[doubleLongPressGesture setNumberOfTouchesRequired:2];
doubleLongPressGesture.delegate = self;
[self.mapview addGestureRecognizer:doubleLongPressGesture];

そして、これが呼び出す関数です

-(void)getMapCoordinateFromTouch:(UILongPressGestureRecognizer *) gesture{
if(gesture.state == UIGestureRecognizerStateBegan){
    CGPoint touchlocation = [gesture locationInView:self.mapview];
    pressedloc = [self.mapview convertPoint:touchlocation toCoordinateFromView:self.mapview];
    [self createBundarywithRadius:.1];    
}
4

1 に答える 1