I created the name MKAnnotation PushPin, which has a title and subtitles. I want to be able to dynamically change the name later. I am close, so I would not need to create a completely new AnnotationView, but if I need to guess that everything is in order. My problem is that as soon as I change the text for the title, the window does not change the size, and some text may be cut depending on how significant the title was.
1) Is there an event that I can trigger to resize the call bubbles window again?
2) In addition, I check that the annotation actually has a title before I proceed to reset the title, but I am having trouble checking it after checking, can anyone help me with this? I'm still new to objective-c, and this one is with me from time to time.
#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";
}
}
source
share