Hi all,
I created an MKAnnotation name PushPin which has a title and subtitle. I want to be able to dynamically change the title at a later time. I'm close so I'd rather not have to make a whole new AnnotationView, but if I have to I guess that's ok too. My problem is that, once I change the text for the title, the window does not resize and some text might get cut off depending on how big the title originally was.
1) Is there an event I can trigger to resize the callout bubble window again?
2) Also, I check to make sure that the annotation actually has a title first before I go resetting the title, but I had some trouble casting it after I checked, can someone help me out with this? I'm still new to objective-c and this one messed with me for a while.
#import <Foundation/Foundation.h>
#import <MapKit/MKAnnotation.h>
@interface PushPin : NSObject <MKAnnotation> {
CLLocationCoordinate2D _coordinate;
NSString *_title;
NSString *_subtitle;
NSString *_ID;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, retain) NSString *title;
@property (nonatomic, retain) NSString *subtitle;
@property (nonatomic, retain) NSString *ID;
- (id) initWithCoordinateAndInformation:(CLLocationCoordinate2D)coordinate title:(NSString *)title subtitle:(NSString *)subtitle;
@end
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
NSLog(@"Annotation was TAPPED!");
if ([view.annotation isKindOfClass:[PushPin class]]) {
view.annotation.title = @"test";
// warning here, that this might not be implemented...
// but it is for this class type, how do I cast it to the correct type?
}
}