2012-03-09 3 views
0

내가 핀이 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 
+0

여기에서 살펴 본다보십시오 사용하여 MKMapView에 추가 할 수 있습니다 : HTTP : //www.raywenderlich.com/2847/introduction- to-mapkit-on-ios-tutorial –

답변

0

다음 NSArray에 추가 (그러나 많은 당신이 원하는) 주석을 만듭니다. 당신이 주석을 포함, MapKit 시작하기에 좋은 튜토리얼입니다, [mapview addAnnotations:annotationArray];

MKMapView Ref

+0

코드 내에서 어떻게 할 수 있습니까? 감사합니다 –

+0

어떤 부분을 혼동하고 있습니까? – bschultz

관련 문제