Organizational Research By

Surprising Reserch Topic

getting annotation pin tap event using -'ios,iphone,mkmapview,mkannotationview'


getting annotation pin tap event  using -'ios,iphone,mkmapview,mkannotationview'

I am loading the mapview as below, with MKAnnotationView added as subview in the mapview. I have added as subview, instead of addAnnotation, as I wanted the annotation view in the center all the time and the mapview to scroll under it.

- (void)viewDidLoad {
    [super viewDidLoad];
    self.mapView.delegate = self;
    [self.mapView addSubview:self.centerAnnotationView];
}

- (MKPointAnnotation *)centerAnnotaion
{
if (!_centerAnnotaion) {
    _centerAnnotaion = [[MKPointAnnotation alloc] init];
    _centerAnnotaion.title = @"Title";
}

return _centerAnnotaion;
}

- (MKPinAnnotationView *)centerAnnotationView
{
if (!_centerAnnotationView) {
    _centerAnnotationView = [[MKPinAnnotationView alloc] initWithAnnotation:self.centerAnnotaion
                                                            reuseIdentifier:@"centerAnnotationView"];
    _centerAnnotationView.pinColor = MKPinAnnotationColorGreen;

    _centerAnnotationView.canShowCallout = YES;
    _centerAnnotationView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
}

return _centerAnnotationView;
}


I have the following questions.


Is it possible to get the default callout even when I haven't added the pin as annotation to the map view.
Is there a way that I could get - (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view event working in my case.
Should I use the tap gesture to capture the tap on the annotation pin?

    
asked Sep 7, 2015 by rajesh
0 votes
9 views



Related Hot Questions



Government Jobs Opening


...