我正在尝试将 mkannotation 添加到我的地图中,但未显示字幕(或者我不知道如何查看它,我有一个 android 设备,很难理解 iphone 是如何工作的)
这是我的 MapPoint.h:
@interface MapPoint : NSObject<MKAnnotation> {
NSString *title;
NSString *subTitle;
CLLocationCoordinate2D coordinate;
}
@property (nonatomic,readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic,copy) NSString *title;
@property (nonatomic,copy) NSString *subTitle;
-(id) initWithCoordinate:(CLLocationCoordinate2D) c title:(NSString *) t subTitle:(NSString *) st;
@end
我的 MapPoint.m:
@implementation MapPoint
@synthesize title,coordinate,subTitle;
-(id) initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString*)t subTitle:(NSString *) st
{
coordinate = c;
[self setTitle:t];
[self setSubTitle:st];
return self;
}
@end
在 Map.m 中,我有:
MapPoint *mp = [[MapPoint alloc] initWithCoordinate:pointCoord title:@"This is the title" subTitle:@"This is the subtitle"];
[mv addAnnotation:mp];
当我触摸我的标记时,我只看到“这是标题:
我想我必须看到这是标题,这是字体较小的副标题。
先感谢您