大佬教程收集整理的这篇文章主要介绍了swift3 – 放大后MapView叠加层正在切断,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
class MapOverlayRenderer: MKOverlayRenderer { var overlayImage: UIImage var plan: Plan init(overlay: MKOverlay,overlayImage: UIImage,plan: Plan) { self.overlayImage = overlayImage self.plan = plan super.init(overlay: overlay) } override func draw(_ mapRect: MKMapRect,zoomScale: MKZoomScale,in ctx: CGContext) { let theMapRect = overlay.boundingMapRect let theRect = rect(for: theMapRect) // Rotate around top left corner ctx.rotate(by: CGFloat(degreesTo@L_696_4@(plan.bearing))); // Draw the image UIGraphicsPushContext(ctX) overlayImage.draw(in: theRect,blendMode: CGBlendMode.normal,alpha: 1.0) UIGraphicsPopContext(); } func degreesTo@L_696_4@(_ x:DoublE) -> Double { return (M_PI * x / 180.0) } }
虽然我不知道实际的原因,但是当我评论ctx.rotate(by :)函数时,这个问题已得到修复.但这不是我的解决方案,因为图像必须处于适当位置.
override func draw(_ mapRect: MKMapRect,in ctx: CGContext) { DispatchQueue.main.async { let theMapRect = overlay.boundingMapRect let theRect = rect(for: theMapRect) // Rotate around top left corner ctx.rotate(by: CGFloat(degreesTo@L_696_4@(plan.bearing))); // Draw the image UIGraphicsPushContext(ctX) overlayImage.draw(in: theRect,alpha: 1.0) UIGraphicsPopContext(); } }
以上是大佬教程为你收集整理的swift3 – 放大后MapView叠加层正在切断全部内容,希望文章能够帮你解决swift3 – 放大后MapView叠加层正在切断所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。