I have created a custom Mk animation class, maplation. To make MKAnnotationView to choose this method one of a family of custom annotations images to a place of discovery and annotationView list of comments since leaving, I'm not setting any trouble or properties I needed it here, I need it here.
After several attempts in establishing custom ticker game and setters in MapLocation.h and .m, I boiled it down where I also (mandatory) the recipient, title, not designated it in Title 2 I am trying to get my return value This is my code:
- (MKAnnotationView *) MapView: (MKMapView *) theMapView viewForAnnotation: (ID & lt; MKAnnotation & gt;) annotation {static NSString * placemarkIdentifier = @ "Show Location identifier "; NSString * str1 = annotation.title; NSString * str2 = annotation.title2; If ([Annotation isKindOfClass: [MapLocation class]]) {MKAnnotationView * annotationView = (MKAnnotationView *) [theMapView dequeueReusableAnnotationViewWithIdentifier: placemarkIdentifier]; If (annotationView == null) {annotationView = [[MKAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: placemarkIdentifier]; } And annotation view. Annotation = annotation; Return annotation view; } Return zero; On the 4th row, the title is returned correctly, but for the method of copied it generates an error message in the 5th line call topic.
I have seen in XCode Docs, but I can not tell me how it looks at this method. Strange that this title looks great, but not TITLE2 copy.
Try changing line dot notation to it:
< Code> NSString * str2 = [annotation heading 2];
And the error should go away.
What is happening is that the compiler has been told that the annotation is a MKAnnotation
. The fact is that you know what other methods it gets, it is irrelevent; The compiler is not mental - they all know that the annotation follows the Mk animation protocol, nothing else.
mapping service * Map Area = (mapping service) is defined why this title MK Anetoteshn that it sees headline recipient. *) Annotation;
Now, you can say
NSString * str2 = mapLocation.title2;
Because you have told the compiler that map space is the object of a map spot.
Comments
Post a Comment