0
我正在開發和iPhone應用程序,我正在使用Mappy SDK IOS。使用Mappy SDK在地圖上添加標記IOS
我到達後顯示地圖並顯示我的當前位置。但我在我的地圖上添加一些標記時遇到問題。
我有一個NSArray包含一些對象的經度和緯度屬性。 我的代碼顯示標誌是:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
//initialisation mot de passe + user
[MPInit initialisation:MAPPY_API_KEY];
[RMMapView class];
//show user location
self.mapView.showsUserLocation = NO;
self.mapView.showPoi = YES;
//set delegate
self.mapView.delegate = self;
MPMarkerManager *markerManager = [self.mapView markerManager];
MPMarkerCategory * category = [markerManager getCategory:@"storeLocations"];
//remove old elements
[category.dataSource removeAllElements];
//add markers on map
for(int i=0; i<self.arrayStores.count; i++) {
NSLog(@"add store %d on the map", i);
NSDictionary* currentStore = [self.arrayStores objectAtIndex:i];
float latitude = [[currentStore objectForKey:@"latitude"] floatValue];
float longitude = [[currentStore objectForKey:@"longitude"] floatValue];
CLLocationCoordinate2D locationStore = CLLocationCoordinate2DMake(latitude, longitude);
//create a new POI object with location
MPPoi * poi = [[MPPoi alloc] initWithUId:[currentStore objectForKey:@"title"] withLocation:locationStore];
[category.dataSource addElement:poi];
self.mapView.centerCoordinate = locationStore;
[poi release];
}
//category settings
category.markerColor = [UIColor greenColor];
//[category setOptimalZoom:YES];//set the zoom to be optimal : show all poi in the category
[category setHideLabelOnTheFirstShow:NO];
[category setAnimateAtFirstShow:YES];
}
,這裏是在控制檯上顯示的日誌:
2012-06-14 17:01:18.359 Koutoubia[609:607] MappyKit version:1.40
2012-06-14 17:01:18.672 Koutoubia[609:607] add store 0 on the map
我我做錯了什麼?因爲標記不顯示
的文檔的文檔上添加標記是:
//add a marker on map
MPMarkerManager *markerManager = [viewController.mapView markerManager];
MPMarkerCategory * category = [markerManager getCategory:HMP_LOC_CATEGORY];
//remove old elements
[category.dataSource removeAllElements];
//create a new POI object with location
MPPoi * poi = [[MPPoi alloc] initWithUId:locationData.address withLocation:findLocation];
[category.dataSource addElement:poi];
[poi release];
文檔的鏈接是here
任何想法?在此先感謝