iOS MapBox RMShape [英] iOS MapBox RMShape
本文介绍了iOS MapBox RMShape的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是刚开始使用RMPolylines和RMShapes的人,我认为我可以正确执行此代码,但是地图上没有显示任何内容:
I am new to using RMPolylines and RMShapes and i think i am executing this code correctly but nothing is showing up on the map:
RMMapBoxSource *tilesource = [[RMMapBoxSource alloc] initWithMapID:kMapID];
[mapView setTileSource:tilesource];
NSArray *locations = [NSArray arrayWithObjects:[[CLLocation alloc] initWithLatitude:-33.981595 longitude:151.072900],[[CLLocation alloc] initWithLatitude:-33.981560 longitude:151.073544],[[CLLocation alloc] initWithLatitude:-33.981560 longitude:151.073845],[[CLLocation alloc] initWithLatitude:-33.981666 longitude:151.074016], nil];
RMAnnotation *annoation43 = [[RMAnnotation alloc] initWithMapView:mapView coordinate:((CLLocation *)[locations objectAtIndex:0]).coordinate andTitle:@"Hola biatches!"];
annoation43.userInfo = locations;
[annoation43 setBoundingBoxFromLocations:locations];
[mapView addAnnotation:annoation43];
-(RMMapLayer *)mapView:(RMMapView *)mapViewer layerForAnnotation:(RMAnnotation *)annotation
{
if (annotation.isUserLocationAnnotation)
return nil;
RMShape *shape = [[RMShape alloc] initWithView:mapView];
shape.lineColor = [UIColor orangeColor];
shape.lineWidth = 5.0;
for (CLLocation *location in (NSArray *)annotation.userInfo)
[shape addLineToCoordinate:location.coordinate];
return shape;
NSLog(@"It is working Dora!");
}
所以我认为我在这里做错了什么,但我无法选择它-如果需要更多代码或信息,请告诉我.
So i think i have done something wrong here but i cannot pick it - if any more code or information is needed just let me know.
推荐答案
好的,现在已经解决了,这似乎是一个简单的问题,但是如果您知道详细的原因,那么我很乐意听到!
Okay it is fixed now and seems to be a simple issue but if you know a detailed WHY this happened I would love to hear it!
添加了以下内容:
mapView.delegate = self;
我以为我已经设置了代表,但显然没有!
I thought i had already set the delegate but evidently not!
这篇关于iOS MapBox RMShape的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文