1
A
回答
1
你需要有實現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
然後,在你的MapView你需要添加公司所在地像下面。
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];
希望這將有助於....
相關問題
- 1. iOS MapKit建立在公園地圖上的標籤
- 2. 如何使用IOS中的mapkit在地圖上顯示用戶
- 3. 谷歌地圖/地方API - 如何告訴特定子公司?
- 4. iOS Mapkit - 緩存地圖?
- 5. IOS地圖(谷歌地圖API與MapKit?)
- 6. 在定製的互動地圖上繪製公司
- 7. iOS如何讓MapKit顯示自定義室內地圖?
- 8. 在iOS上使用MapKit搜索地址
- 9. 從谷歌地圖將MapKit在iOS
- 10. iOS地圖 - 帶有圖標的MapKit MKAnnotation
- 11. MapKit公交視圖
- 12. Iphone Mapkit:在地圖上顯示圖像
- 13. 在地圖上獲取所有公司分支機構的位置
- 14. MapKit自定義地圖
- 15. 如何在LinkedIn中使用json定位多個公司股票
- 16. 的iOS迅速MapKit,別針從沒有出現在地圖上
- 17. iOS MapKit - 如何將地圖放置在從視圖中的文本字段獲得的特定位置?
- 18. IOS定製Segue公司和ContainerView
- 19. 如何在公司網站上顯示Google地方信息?
- 20. 沒有初始化地圖的iOS MapKit用戶位置
- 21. Recenter MapKit地圖
- 22. 如何在公司的FireStore
- 23. 如何在Vue公司
- 24. 我如何創建一個顯示我們公司位置的動態地圖?
- 25. 如何母公司
- 26. 如何Brightcove公司
- 27. 綁定DataViz公司圖表(條形圖)本地使用角
- 28. 從IP地址確定公司名稱
- 29. MapKit中的自定義地圖樣式
- 30. 檢索公司由多位
您需要定義你所說的「一個公司的位置」的意思。我想你的意思是總部地址。獲得地址後,您可以使用mapkit地理編碼API獲取座標。 – Felix
根據Apples的「位置感知編程指南」,您可以使用'CLGeoCoder'獲取'Apple Inc.'的座標。 – pre