회사 이름 등을 사용하여지도에서 회사를 찾고자하는 간단한지도를 개발 중입니다. 예 : "Apple Inc.".지도에서 회사를 찾는 방법 (mapkit iOS)
어떻게하면됩니까?
고맙습니다.
감사 Yashu
회사 이름 등을 사용하여지도에서 회사를 찾고자하는 간단한지도를 개발 중입니다. 예 : "Apple Inc.".지도에서 회사를 찾는 방법 (mapkit iOS)
어떻게하면됩니까?
고맙습니다.
감사 Yashu
당신은 MKAnnotation 프로토콜을 구현하는 클래스가 있어야합니다. 다음은 여기에 예를
@interface MapPin : NSObject<MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, readonly) NSString *title;
@property (nonatomic, readonly) NSString *subtitle;
- (id)initWithCoordinates:(CLLocationCoordinate2D)location placeName:(NSString *)placeName description:(NSString *)description;
@end
인 구현 :
@implementation MapPin
@synthesize coordinate;
@synthesize title;
@synthesize subtitle;
- (id)initWithCoordinates:(CLLocationCoordinate2D)location placeName:placeName description:description {
self = [super init];
if (self != nil) {
coordinate = location;
title = placeName;
[title retain];
subtitle = description;
[subtitle retain];
}
return self;
}
- (void)dealloc {
[title release];
[subtitle release];
[super dealloc];
}
@end
그런 다음,지도보기에서 아래 등 기업의 위치를 추가해야합니다. 이 도움이 될 것입니다
CLLocationCoordinate2D coord = [[[CLLocation alloc] initWithLatitude:35.936902 longitude:-79.024953] coordinate];//Here you need to mention your company latitude and longitude
MapPin *pin = [[MapPin alloc] initWithCoordinates:coord placeName:@"Apple Inc" description:@""];
[map addAnnotation:pin];
희망 ....
당신은 당신이 "회사의 위치"가 무슨 뜻인지 정의해야합니다. 본사 주소를 뜻하는 것 같아요. 주소가 있으면 mapkit 지오 코딩 API를 사용하여 좌표를 가져올 수 있습니다. – Felix
사과에 따르면 "Location Awareness Programming Guide"는 'CLGeoCoder'를 사용하여 'Apple Inc.'의 좌표를 가져올 수 있습니다. – pre