当用户滚动滚动视图时,我正在尝试倾斜地图,如下所示:
func scrollViewDidScroll(_ scrollView: UIScrollView)
{
//Safely access my MKMapView and limit pitch between 0 and 70
if let map = mapVw, 0 ..< 70 ~= scrollView.contentOffset.y
{
map.camera.pitch = scrollView.contentOffset.y
}
}
但是地图会缩小。有人知道为什么吗?
我已经尝试设置新的MKMapCamera对象。像这样:
func scrollViewDidScroll(_ scrollView: UIScrollView)
{
if let map = mapVw, 0 ..< 70 ~= scrollView.contentOffset.y
{
let newCam = MKMapCamera(lookingAtCenter: map.centerCoordinate,
fromDistance: 500,
pitch: scrollView.contentOffset.y,
heading: 0)
map.setCamera(newCam, animated: false)
}
}
}
但这也不起作用...