我有这段代码,它给我和Cannot convert value of type 'CLLocationDirection' (aka 'Double') to expected argument type 'Float'
上的arrowImageView.transform = CGAffineTransformMakeRotation(CGFloat(self.degreesToRadians(direction)))
。请帮我修复。谢谢。无法将类型'CLLocationDirection'(又名'Double')的值转换为预期参数类型'Float'
func locationManager(manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
var direction: CLLocationDirection = newHeading.magneticHeading
if direction > 180 {
direction = 360 - direction
}
else {
direction = 0 - direction
}
// Rotate the arrow image
if let arrowImageView = self.arrowImageView {
UIView.animateWithDuration(1.0, animations: {() -> Void in
arrowImageView.transform = CGAffineTransformMakeRotation(CGFloat(self.degreesToRadians(direction)))
})
而且还有可能使指南针指向由用户指定的经度和纬度吗?你能教我怎么做。非常感谢。
强权即那么对于Radadians来说,这个度数是否会达到Float?如果这样self.degreesToRadians(浮动(方向))可能会做的伎俩。 –
这样做了工作伴侣。谢谢。关于我的第二个问题。是否可以使指南针指向由用户指定的经度和纬度?你能教我怎么做。 – Dze