Tôi đã có ứng dụng bản đồ để đặt chú thích trên bản đồ, khi bạn nhấn vào chú thích, nó sẽ hiển thị chú dẫn có thuộc tính tiêu đề.ios mapkit đóng chú thích chú thích bằng cách chạm vào bản đồ
Tính năng này hoạt động tốt nhưng người dùng không thể đóng chúng. Chúng vẫn mở cho đến khi chúng nhấn vào một chú thích khác. Tôi không thể làm cho nó mà người dùng có thể khai thác khác trên bản đồ (hoặc bấm vào chú thích một lần nữa) để đóng nó?
Tôi có cảm giác đây là cài đặt mặc định, vì vậy có lẽ điều tôi đang làm đang nhồi nhét nó? Tôi có một nhận dạng cử chỉ mà tôi sử dụng để phát hiện một số đồ vòi
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleTap:)];
tap.numberOfTapsRequired = 1;
[self.mapView addGestureRecognizer: tap];
bắn những viên đạn này:
- (void)handleTap:(UITapGestureRecognizer *)sender {
if (sender.state == UIGestureRecognizerStateEnded) {
CGPoint tapPoint = [sender locationInView:sender.view.superview];
CLLocationCoordinate2D coordinate = [self.mapView convertPoint: tapPoint toCoordinateFromView: self.mapView];
if (pitStopMode && !pitStopMade){
pitStopMade = YES;
InfoAnnotation *annotation = [[InfoAnnotation alloc]
initNewPitstopWithCoordinate:coordinate];
NSLog(@" Created Pit Stop");
annotation.draggable = NO;
//place it on the map
[self.mapView addAnnotation: annotation];
self.instructionLabel.text = @"Tap button again to remove";
annotation.creatorId = self.localUser.deviceId;
//send it to the server
[annotation updateLocationWithServerForConvoy: self.convoyCode];
[annotation release];
}
if (hazardMode && !hazardMade){
hazardMade = YES;
InfoAnnotation *annotation = [[InfoAnnotation alloc]
initNewHazardWithCoordinate:coordinate];
NSLog(@" Created Hazard");
annotation.draggable = NO;
//place it on the map
[self.mapView addAnnotation: annotation];
self.instructionLabel.text = @"Tap button again to remove";
annotation.creatorId = self.localUser.deviceId;
//send it to the server
[annotation updateLocationWithServerForConvoy: self.convoyCode];
[annotation release];
}
}
}
Có điều gì tôi phải làm cũng để cho những vòi nước đi qua vào mapview? Kéo và khai thác trên chú thích hoạt động tốt mặc dù vậy tôi không chắc chắn nếu đây là những gì gây ra nó?
có tùy chọn nào tôi bị thiếu hoặc tôi có phải thử và triển khai thủ công điều này không?