I kept looking for hours, trying to get and update somehting to work on iOS 5 for a drop and drag pin. I think i'm pretty close... but stock when trying to init a custom annotation.
Here's my class
.h
@interface AnnotationView : MKAnnotationView ...
.m
@interface AnnotationView ()
@property (nonatomic, assign) BOOL hasBuiltInDraggingSupport;
@end
@implementation AnnotationView
@synthesize hasBuiltInDraggingSupport, mapView;
- (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier {
self.hasBuiltInDraggingSupport = [[MKAnnotationView class] instancesRespondToSelector:NSSelectorFromString(@"isDraggable")];
if (self.hasBuiltInDraggingSupport) {
if ((self = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier])) {
[self performSelector:NSSelectorFromString(@"setDraggable:") withObject:[NSNumber numberWithBool:YES]];
}
}
self.canShowCallout = YES;
return self;
}
@end
And the problem is on the line
self = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:reuseIdentifier]
it says : Incompatible pointer types assigning to 'AnnotationView * __strong' from 'MKPinAnnotationView *'
Also, the next line is getting a warning to
[self performSelector:NSSelectorFromString(@"setDraggable:") withObject:[NSNumber numberWithBool:YES]];
Thx
The warning says that setDraggable: selector is unknow.. but shouldn't be herited from