1

我添加了一个注释,在viewforannotation中我设置了canshowcallout并选择了注释,但它没有被选中......

  -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
    currentCoordinates = newLocation.coordinate;
 ParkPlaceMark *pa = [[ParkPlaceMark alloc] init];
        pa.coordinate = currentCoordinates;
        pa.title = @"POI";
        pa.title2 = @"CUrrent Locn";
        pa.subtitle = @"Drag and drop to adjust the position if necessary";
        [mapView addAnnotation:pa];
        [pa release];
   }
   - (MKAnnotationView *)mapView:(MKMapView *)map
        viewForAnnotation:(ParkPlaceMark*)annotation {

MKAnnotationView *test=[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"parkingloc"];
if([annotation.title caseInsensitiveCompare:@"POI"] == NSOrderedSame)
{
    test.annotation = annotation;

    test.userInteractionEnabled = YES;
    test.draggable = YES;
    //        test.pinColor = MKPinAnnotationColorRed;

    [test setImage:[UIImage imageNamed:@"marker3.png"]];
    [test setEnabled:YES];
    [test setCanShowCallout:YES];
    [test setDragState:MKAnnotationViewDragStateEnding animated:YES];
    [self.mapView selectAnnotation:test.annotation animated:YES];
    return test;
   }
  }
4

1 回答 1

1

我添加了自定义动画所以

  [self.mapView selectAnnotation:test.annotation animated:YES];

没有工作。正确的代码是:

  [self.mapView selectAnnotation:test.annotation animated:NO];
于 2012-09-28T11:14:31.567 回答