Я получил мое приложение, сбросив штифт длинным касанием, я позволяю пользователям сбрасывать только два пина, и это работает, я думаю ... но каждый раз, когда я нажимаю, чтобы добавить штырек в симуляторе, он добавляет два пина (не только один). . вот код:
-(void) handleLongPressGesture:(UIGestureRecognizer*)sender
{
if (pinId < 3) {
// Here we get the CGPoint for the touch and convert it to
// latitude and longitude coordinates to display on the map
CGPoint point = [sender locationInView:self.mapView];
CLLocationCoordinate2D coord = [self.mapView convertPoint:point
toCoordinateFromView:self.mapView];
if (pinId == 1) {
lat1 = coord.latitude;
long1 = coord.longitude;
MapAppAnnotation* annotation;
annotation = [[MapAppAnnotation alloc] initWithCoordinate:coord
andID:pinId];
[mapView addAnnotation:annotation];
MKCircle* circle = [MKCircle circleWithCenterCoordinate:coord
radius:5000];
[mapView addOverlay:circle];
pinId++;
} else {
lat2 = coord.latitude;
long2 = coord.longitude;
MapAppAnnotation* annotation2;
annotation2 = [[MapAppAnnotation alloc] initWithCoordinate:coord
andID:pinId];
[mapView addAnnotation:annotation2];
}
}
}
Я хотел бы знать, является ли моя ошибка (кодовая ошибка ..) или симулятором iPhone, который получает мое длинное нажатие мыши, как два разных длинных нажатия ... это возможно?