Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift 如何使用叠加边缘上的控制柄调整mapOverlay的大小?_Swift_Mapkit_Overlay_Mkcircle - Fatal编程技术网

Swift 如何使用叠加边缘上的控制柄调整mapOverlay的大小?

Swift 如何使用叠加边缘上的控制柄调整mapOverlay的大小?,swift,mapkit,overlay,mkcircle,Swift,Mapkit,Overlay,Mkcircle,正如标题所说,我想知道如何实现覆盖边缘的黑色手柄/按钮 当前用于创建覆盖和注释的代码I用户 func makeAnnotation(locationCoordinate: CLLocationCoordinate2D){ let overlay = MKCircle(center: locationCoordinate, radius: 100) let allOverlays = self.mapView.overlays let annotation = MKPoi

正如标题所说,我想知道如何实现覆盖边缘的黑色手柄/按钮

当前用于创建覆盖和注释的代码I用户

func makeAnnotation(locationCoordinate: CLLocationCoordinate2D){
    let overlay = MKCircle(center: locationCoordinate, radius: 100)
    let allOverlays = self.mapView.overlays
    let annotation = MKPointAnnotation()
    let allAnnotations = self.mapView.annotations
    if self.mapView.annotations.isEmpty == false {

        self.mapView.removeAnnotations(allAnnotations)
        self.mapView.removeOverlays(allOverlays)
    }

    //Make coordinats into adress
    let location = CLLocation(latitude: locationCoordinate.latitude, longitude: locationCoordinate.longitude)
    CLGeocoder().reverseGeocodeLocation(location, completionHandler: {(placemarks, error) -> Void in
        if error != nil {
            print(error as Any)
        }
        let placemark = placemarks?[0]
        guard let street = placemark?.thoroughfare else {
            return annotation.title = ""
        }
        guard let addressNumber = placemark?.subThoroughfare else {
            return annotation.title = street

        }
        self.fullAdress = street + " " + addressNumber
        annotation.title = self.fullAdress

    })
    annotation.coordinate = locationCoordinate
    mapView.add(overlay)
    mapView.addAnnotation(annotation)
}
它看起来怎么样


我刚刚基于ResizebleKcircleOverlay创建了这个Pod

我必须对MKMapView进行子类化,以获得良好的抽象层。如果您已经有了一个功能简单的MapViewController,那么它实际上很容易与当前的MapViewController集成


我刚刚基于ResizebleKcircleOverlay创建了这个Pod

我必须对MKMapView进行子类化,以获得良好的抽象层。如果您已经有了一个功能简单的MapViewController,那么它实际上很容易与当前的MapViewController集成


退房。谢谢,但那是在objective-C中。不幸的是,您可以使用Swift的objective-C框架。好的,我试试!谢谢,但这是在objective-C中不幸的是,你可以使用Swift的objective-C框架。好的,我试试!