I am working on my first swift application for the iPad. Thus far I have a basic mapview with a button in the bottom toolbar, which I would like to refresh and focus onto th
As @Orkhan said you can do it in this way.
If you want to do the action you just simple ctrl-drag to viewController and select "Action".
After that you can add code to the handler.
var location: CLLocation!
@IBAction func refreshLocation(sender: AnyObject) {
let center = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01))
self.map.setRegion(region, animated: true)
}
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
self.location = locations.last as CLLocation
}