这是我的两个函数,我想将信息从函数转换到另一个,而不需要声明一个变量来存储信息,因为总是当我启动我的应用程序时,初始变量是显示的那个
func action(gestureRecognizer: UIGestureRecognizer) {
var touchPoint = gestureRecognizer.locationInView(self.mapView)
var location:CLLocationCoordinate2D = mapView.convertPoint(touchPoint, toCoordinateFromView: self.mapView)
var latDelta:CLLocationDegrees = 0.01
var lonDelta:CLLocationDegrees = 0.01
var span:MKCoordinateSpan = MKCoordinateSpan(latitudeDelta:latDelta, longitudeDelta: lonDelta)
var region:MKCoordinateRegion = MKCoordinateRegion(center: location, span: span)
mapView.setRegion(region, animated: true)
var annotation = MKPointAnnotation()
annotation.coordinate = location
annotation.title = ""
}
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
var userLocation:CLLocation = locations[0] as! CLLocation
CLGeocoder().reverseGeocodeLocation(userLocation, completionHandler: { (placeMarks, error) -> Void in
if error != nil
{
println("error: \(error)")
}
else {
let place = CLPlacemark(placemark: placeMarks?[0] as! CLPlacemark)
}
})
}