iosobjective-cmkmapview

How to stop scrolling in mkmapview?


I'm using a MKMapView in my application and use mapView.scrollEnabled=NO; but it's not working. Here is my code:

mapView=[[MKMapView alloc] initWithFrame:CGRectMake(20, 100, 282, 209)];
mapView.delegate=self;
mapView.scrollEnabled=YES;
[self.view addSubview:mapView];

Is there something wrong with my code?


Solution

  • You have used YES instead of NO in your code. Please use NO as below.

    mapView.scrollEnabled = NO;
    

    Swift

    mapView.isScrollEnabled = false