为注释方法添加可拖动支持

时间:2011-04-12 09:56:37

标签: iphone ipad annotations mapkit

我有一个处理mapkit和注释的应用程序,它工作正常,现在我想添加DRAGGABLE注释。我该怎么做才能添加这个功能?这是我的annotation.m类:

//
// MapDemoAnnotation.m
// MapDemo
//
// Created by Riccardo Queri on 12/01/11.
// Copyright 2011 Unipg. All rights reserved.
//

#import "MapAppAnnotation.h"


@implementation MapAppAnnotation

@synthesize coordinate=_coordinate;
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate{
self = [super init];
if (self != nil) {
_coordinate = coordinate;
}
return self;
}
- (void)setCoordinate:(CLLocationCoordinate2D)newCoordinate{


}
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate andID:(NSUInteger)pinID{
self = [super init];
if (self != nil) {
_coordinate = coordinate;
_pinID = pinID;
}
return self;
}

- (NSString *)title {
return [NSString stringWithFormat:@"Boa %u", _pinID];
}

- (NSString *)subtitle {
return [NSString stringWithFormat:@"%.4f, %.4f", _coordinate.latitude, _coordinate.longitude];
}

@end

1 个答案:

答案 0 :(得分:0)

MKAnnotationViewdraggable属性.....你可以使用它。你可以根据自己的需要进行设置。

感谢