I am having a hard time getting the type of the map to switch types.
@IBAction func changeMapType(sender: AnyObject) {
if mapView.mapType == MKMapType.Standard {
mapView.mapType == MKMapType.Satellite
}
else {
mapView.mapType == MKMapType.Standard
}
}
I was following this guide http://www.techotopia.com/index.php/Working_with_Maps_on_iOS_8_with_Swift%2C_MapKit_and_the_MKMapView_Class and made it to the end, and it will zoom but it will not change types. They used the code:
- (IBAction)changeMapType:(id)sender {
if mapView.mapType == MKMapType.Standard {
mapView.mapType = MKMapType.Satellite
} else {
mapView.mapType = MKMapType.Standard
}
}
but i really don't understand why.
0 comments:
Post a Comment