Adam Adam - 8 months ago 73
iOS Question

User Location Finder

I've got an button that when it is pressed it goes to users location. Can't figure out what to put in so I can get the zoom on the users location.

The following code I put in my button.

@IBAction func Refreshbutton(sender: AnyObject) {
Mapview.setCenterCoordinate(Mapview.userLocation.coordinate, animated: true)


this is how I do it in Swift:

   @IBAction func CenterMapToUserLocation(sender: AnyObject) {
        let latitude = locationManager.location?.coordinate.latitude
        let longitude = locationManager.location?.coordinate.longitude
        let span = MKCoordinateSpanMake(0.02, 0.02)
        let region = MKCoordinateRegion(center:CLLocationCoordinate2D(latitude: latitude!, longitude: longitude!),span: span)
        tripMapView.setRegion(region, animated: true)