相关疑难解决方法(0)

如何使自定义MKAnnotation可拖动

我需要具有不同引脚图像的MKAnnotation.
所以我创建了以下:

@interface NavigationAnnotation : NSObject <MKAnnotation>
- (id)initWithName:(NSString*)name address:(NSString*)address coordinate:(CLLocationCoordinate2D)coordinate;
...
@interface NavigationAnnotation ()
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *address;
@property (nonatomic, assign) CLLocationCoordinate2D theCoordinate;
@end

@implementation NavigationAnnotation


- (id)initWithName:(NSString*)name address:(NSString*)address coordinate:(CLLocationCoordinate2D)coordinate {
    if ((self = [super init])) {
        if ([name isKindOfClass:[NSString class]]) {
            self.name = name;
        } else {
            self.name = @"Unknown charge";
        }
        self.address = address;
        self.theCoordinate = coordinate;
    }
    return self;
}

- (NSString *)title {
    return _name;
}

- (NSString *)subtitle …
Run Code Online (Sandbox Code Playgroud)

objective-c mkmapview mkannotation ios

4
推荐指数
1
解决办法
2909
查看次数

标签 统计

ios ×1

mkannotation ×1

mkmapview ×1

objective-c ×1