내가 핀이 1 개인 경우 핀을 탭하면 정보가 표시됩니다. 그러나 다른 위치에 1 개 이상의 핀이 필요합니다. 어떻게하면 좋을까요?Pin Annotation이 두 개 이상 있습니까? MapKit
이것은 내 코드입니다.
Map.m
- (void)viewDidLoad
{
[super viewDidLoad];
[mapview setMapType:MKMapTypeStandard];
[mapview setZoomEnabled:YES];
[mapview setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, {0.0, 0.0 } };
region.center.latitude = 52.509078;
region.center.longitude = -1.884799;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapview setRegion:region animated:YES];
NewClass *ann = [[NewClass alloc] init];
ann.title = @"AVFC";
ann.subtitle = @"Aston Villa Football Club";
ann.coordinate = region.center;
[mapview addAnnotation:ann];
// Do any additional setup after loading the view, typically from a nib.
}
NewClass.h는
@interface NewClass : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
NSString *titleOne;
NSString *subtitleTwo;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@property (nonatomic, copy) NSString *titleOne;
@property (nonatomic, copy) NSString *subtitleTwo;
@end
여기에서 살펴 본다보십시오 사용하여
MKMapView
에 추가 할 수 있습니다 : HTTP : //www.raywenderlich.com/2847/introduction- to-mapkit-on-ios-tutorial –