I have a UISlider whose value varies between -31 and 0. The initial value is 0.
I can't understand why when I change the value of my slider (taking it for example 0,-1, -2, -3, ..., -20), this value is not reported correctly inside the func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?
, but rather always remains 0.
How can I report every single change of the slider value within that function?
class MapViewController: UIViewController,MKMapViewDelegate,CLLocationManagerDelegate,SCSEarthquakesHandler,SCSPublicSeismometersHandler
{
@IBOutlet weak var mapView: MKMapView!
@IBOutlet var slider: UISlider!
@IBAction func changeSliderValue(_ sender: Any){
let newDate = calendar.date(byAdding: .day, value: slider, to:rigthNow)
dateFormatter.dateStyle = .medium // "MM/GG/AAAA"
labelTime.text = "\(dateFormatter.string(from: newDate!))"
}
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?{
print(Int(slider.value))
//some other piece of code that is not needed now for this problem
}
}