I have few problems with my iphone application. I have such classes and interfaces:
CinemaMapAnnotation.h
CinemaMapAnnotation.m
CinemasMapController.h
#import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import "Cinema.h" #import "CinemaMapAnnotation.h" #import "PopcornuaAppDelegate.h" @interface CinemasMapController : UIViewController <MKMapViewDelegate, MKReverseGeocoderDelegate> { MKMapView *mapView; MKReverseGeocoder *reverseGeokoder; } @property (nonatomic, retain) IBOutlet MKMapView *mapView; @property (nonatomic, retain) IBOutlet MKReverseGeocoder *reverseGeokoder; @end
CinemasMapController.m
#import "CinemasMapController.h" @implementation CinemasMapController @synthesize mapView, reverseGeokoder; ... #pragma mark - Map Anotation - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id)annotation { static NSString* MyIdentifier = @"CinemaMapAnotation"; MKPinAnnotationView* pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:MyIdentifier]; if (!pinView) { MKPinAnnotationView* pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:MyIdentifier] autorelease]; pinView.draggable = NO; pinView.animatesDrop = NO; pinView.enabled = YES; } else { pinView.annotation = annotation; } if(annotation != mapView.userLocation){ pinView.pinColor = MKPinAnnotationColorRed; pinView.canShowCallout = YES;
My problem is that everything shows and works, except that the rightCalloutAccessoryView button is not displayed. mapView is connected and has delegete for the CinemasMapController on the iphone screen (I will also try [mapView setDelegate: self]). So what am I doing wrong?
PS Code with line
pinView.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
run - verified by NSLog.
Here's what it looks like - there is no button: 
source share