我有一个项目是从另一个开发人员编写的,在didSelectAnnotationView
内部有以下几行代码:
我无法理解他在height
之后使用这些行的原因
我也评论过他们,没有任何改变。
let mapMarker = view.annotation as! MapMaker
self.selMapMarker = mapMarker;
let selectedAnnoView = self.selMapMarker.view
if selectedAnnoView != nil {
selectedAnnoView?.image = nil;
selectedAnnoView?.image = UIImage(named: self.selMapMarker.nameImage)
}
var height = (selectedAnnoView?.frame.size.height)! + 10.0;
height = height / mapView.frame.size.height;
height = 1.0 - height / 2.0;
let markerPoint = self.mapView.convertCoordinate(mapMarker.coordinate, toPointToView: self.mapView);
var mapFrame = self.mapView.convertRegion(self.mapView.region, toRectToView: self.mapView);
mapFrame.origin.y = markerPoint.y - mapFrame.size.height * height;
mapFrame.origin.x = markerPoint.x - mapFrame.size.width / 2.0;
任何人都可以理解他们可以做什么或者没有太多信息?