MKPinAnnotationView не движется - PullRequest
       7

MKPinAnnotationView не движется

0 голосов
/ 23 августа 2011

Я просмотрел здесь несколько ссылок, не все из них, касающиеся MKPinAnnotationView pin, подкласса и т. Д. Я сделал несколько простых онлайн-уроков, и когда я подумал, что смогу начать свое приложение со знаниями из этих уроков,Я был неправ.: (

В моем учебном файле мне удалось сделать простой вывод MKPinAnnotationView *. Установите его свойства, например canShowCallOut = YES, draggable = YES. Я могу перетащить этот вывод в любое место и отобразить местоположение, в котором он находится.упал в.

Но когда я создал свое новое приложение, я сделал то же самое снова. Но булавка не двигается, есть ли что-то, что я сделал неправильно?

    - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{

    if([annotation isKindOfClass:[CustomPlacemark class]])
    {
        MKPinAnnotationView *newAnnotation = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:[annotation title]];
        newAnnotation.pinColor = MKPinAnnotationColorGreen;
        newAnnotation.animatesDrop = YES; 
        newAnnotation.canShowCallout = YES; // shows the black label when the pin is tapped
        newAnnotation.draggable = YES;
//      newAnnotation.enabled = YES;
        newAnnotation.tag = tag;
        NSLog(@"%@ %@", [annotation title], [annotation subtitle]);
        UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
        [rightButton addTarget:self
                        action:@selector(showDetails:)
              forControlEvents:UIControlEventTouchUpInside];
        newAnnotation.rightCalloutAccessoryView = rightButton;

        NSLog(@"Created annotation at: %f %f", ((CustomPlacemark*)annotation).coordinate.latitude, ((CustomPlacemark*)annotation).coordinate.longitude);

        [newAnnotation addObserver:self
                        forKeyPath:@"selected"
                           options:NSKeyValueObservingOptionNew
                           context:@"GMAP_ANNOTATION_SELECTED"];

        [newAnnotation autorelease];
        tag++;
        NSLog(@"ååååååååå %@", appDelegate.fml);
        return newAnnotation;
    }

    return nil;
}

1 Ответ

0 голосов
/ 09 ноября 2011
...