作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
这个弃用方法的替代逻辑是什么
MKPolylineView *polylineView = [[MKPolylineView alloc] initWithOverlay:overlay];
polylineView.lineWidth = 3;
polylineView.strokeColor = [[UIColor alloc] initWithRed:5.0/255 green:102.0/255 blue:48.0/255 alpha:1];
MKCircleView *circleView = [[MKCircleView alloc] initWithOverlay:overlay];
circleView.strokeColor = [UIColor blueColor];
circleView.fillColor = [[UIColor blueColor] colorWithAlphaComponent:0.4];
circleView.lineWidth = 2;
最佳答案
引用MKPolylineView
和MKCircleView
的文档:
// Prefer MKPolylineRenderer
MKPolylineRenderer *polylineView = [[MKPolylineRenderer alloc] initWithOverlay:overlay];
polylineView.lineWidth = 3;
polylineView.strokeColor = [[UIColor alloc] initWithRed:5.0/255 green:102.0/255 blue:48.0/255 alpha:1];
//Prefer MKCircleRenderer
MKCircleRenderer *circleView = [[MKCircleRenderer alloc] initWithOverlay:overlay];
circleView.strokeColor = [UIColor blueColor];
circleView.fillColor = [[UIColor blueColor] colorWithAlphaComponent:0.4];
circleView.lineWidth = 2;
关于ios 7 initWithOverlay 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27606841/
我是一名优秀的程序员,十分优秀!