-1

I am trying to inherit from MKPinAnnotation in this manner:

MKPinAnnotationView -->MyPoint-->PhotoPoint

but I get an error in Xcode saying PhotoPoint can't be defined without a base class.

Here is my code in MyPoint.h:

#import <MapKit/MKPinAnnotationView.h>
@interface MyPoint:NSObject<MKAnnotation>{...}

then in PhotoPoint.h:

@interface PhotoPoint:MyPoint

and this is where I get the error...does anyone have any ideas?

  • please consider mark your question with properly tag! Anyway... http://mralek.se/post/9591337792/easy-custom-mkpinannotationview-with-pin-drop – felipsmartins Dec 04 '13 at 15:25
  • Are you trying to create a class for your annotation _model_ objects (id) or are you really trying to create a custom subclass of MKPinAnnotationView for your annotation _views_? –  Dec 04 '13 at 15:35
  • I just want to change the pin color depending if it is Photopoint of MyPoint so I subclass the MKPinAnnotationView..but now my code just exploded! – user3036511 Dec 04 '13 at 15:53
  • Have you implemented the viewForAnnotation delegate method? If so, please show that code (add the code to the question). –  Dec 04 '13 at 17:16
  • @user3036511: It looks like PhotoPoint and MyPoint are classes that implement MKAnnotation (ie. they are your annotation model objects). It doesn't make sense to make them "inherit from MKPinAnnotationView". You don't need to inherit or subclass MKPinAnnotationView just to set the pinColor. As I've mentioned, this is most easily done in the viewForAnnotation delegate method. –  Dec 04 '13 at 18:52

1 Answers1

0

In PhotoPoint.h you need to import MyPoint.h.

#import "MyPoint.h"

@interface PhotoPoint : MyPoint
rmaddy
  • 314,917
  • 42
  • 532
  • 579