MapAnnotation.h는
#import <Foundation/Foundation.h>
#import <MapKit/MKAnnotation.h>
@interface MapAnnotation : NSObject <MKAnnotation>
@property(nonatomic, assign) CLLocationCoordinate2D coordinate;
@property(nonatomic, copy) NSString *title;
@property(nonatomic, copy) NSString *subtitle;
-(id)initWithCoordinate:(CLLocationCoordinate2D)Region withtitle:(NSString *)Title andSubTitle:(NSString *)SubTitle ;
MapAnnotation.m는지도보기를 사용하는 클래스의 값을 할당
@implementation EventAtPlacesAnnotation
@synthesize title = _title, subtitle = _subtitle,coordinate = _coordinate;
-(id)initWithCoordinate:(CLLocationCoordinate2D)Region withtitle:(NSString *)Title andSubTitle:(NSString *)SubTitle
{
self = [super init];
if(self){
_title = Title;
_subtitle = SubTitle;
_coordinate = Region;
}
return self;
}
CLLocationCoordinate2D newCoordinate = CLLocationCoordinate2DMake(40.56, 90.83);
MapAnnotation *firstannotation = [[MapAnnotation alloc]initWithCoordinate:newCoordinate withtitle:@"Place 1" andSubTitle:@"Near To empire state"];
[myMapview addAnnotation:firstannotation];
_a의 가치는 무엇입니까? @ 인터페이스의 CustomAnnotation : 다음 MKAnnotation 프로토콜 구현 –
클래스 NSObject의를 내가 주석의 제목과 자막 예상 정확히지도에 표시되어 있기 때문에 나는이 붙여 –
gdanov