一切都在主题中,所以这里是代码
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_pathRenderer = [[MKOverlayPathRenderer alloc] init];
_pathRenderer.lineWidth = 8.0f;
_pathRenderer.strokeColor = [UIColor redColor];
_pathRenderer.path = CGPathCreateMutable();
[_mapView addOverlay:_pathRenderer];
}
在最后一行,它异常下降:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MKOverlayPathRenderer boundingMapRect]: unrecognized selector
这意味着我使用了不实现 MKOverlay 的错误类,我明白了,但正如 MKOverlayPathRenderer 的参考中所说 - 它确实如此。所以我有点卡在这个问题上。