自定义叠加(圆形)

发布于 2024-10-05 04:05:14 字数 633 浏览 0 评论 0原文

我试图显示一个圆形的叠加层 在 5000 x 5000 的区域 我在 viewDidLoad 中按以下方式定义了圆圈

MKCircle* circle = [MKCircle circleWithCenterCoordinate:coordinate radius:500];
[mapView addOverlay:circle];

,对于覆盖视图,我给出了以下代码

-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id)overlay {
 MKCircleView* circleView = [[[MKCircleView alloc] initWithOverlay:overlay] autorelease];
 circleView.strokeColor = [UIColor redColor];
 circleView.lineWidth = 2.0;
 //Uncomment below to fill in the circle
 circleView.fillColor = [UIColor redColor];
 return circleView;
}

,但是当我运行此代码时,仅加载地图,错误是什么?

i was trying to show an overlay with circle shape
in a region of 5000 by 5000
i defined the circle in the following way in viewDidLoad

MKCircle* circle = [MKCircle circleWithCenterCoordinate:coordinate radius:500];
[mapView addOverlay:circle];

and for the overlay view i gave the following code

-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id)overlay {
 MKCircleView* circleView = [[[MKCircleView alloc] initWithOverlay:overlay] autorelease];
 circleView.strokeColor = [UIColor redColor];
 circleView.lineWidth = 2.0;
 //Uncomment below to fill in the circle
 circleView.fillColor = [UIColor redColor];
 return circleView;
}

but when i run this,only the map gets loaded,what is the error??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文