Gradle 0.9.2 с Appengine 1.4.2

В iOS7 rectForMapRect: и mapRectForRect: устарели и теперь являются частью класса MKOverlayRenderer. Я бы предпочел использовать методы MapView mapRectThatFits: edgePadding:. Вот пример кода:

MKMapRect visibleRect = self.mapView.visibleMapRect;
UIEdgeInsets insets = UIEdgeInsetsMake(50, 50, 50, 50);
MKMapRect biggerRect = [self.mapView mapRectThatFits:visibleRect edgePadding:insets];

последний Swift для 2017 ...

func updateMap() {

    mkMap.removeAnnotations(mkMap.annotations)
    mkMap.addAnnotations(yourAnnotationsArray)

    var union = MKMapRectNull

    for p in yourAnnotationsArray {
        // make a small, say, 50meter square for each
        let pReg = MKCoordinateRegionMakeWithDistance( pa.coordinate, 50, 50 )
        // convert it to a MKMapRect
        let r = mkMapRect(forMKCoordinateRegion: pReg)

        // union all of those
        union = MKMapRectUnion(union, r)

        // probably want to turn on the "sign" for each
        mkMap.selectAnnotation(pa, animated: false)
    }

    // expand the union, using the new #edgePadding call. T,L,B,R
    let f = mkMap.mapRectThatFits(union, edgePadding: UIEdgeInsetsMake(70, 0, 10, 35))

    // NOTE you want the TOP padding much bigger than the BOTTOM padding
    // because the pins/signs are actually very tall

    mkMap.setVisibleMapRect(f, animated: false)

}
7
задан Axel Fontaine 12 February 2011 в 14:16
поделиться