Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 536
San Avatar asked Nov 30 '25 11:11

San


2 Answers

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

mapView.scrollEnabled = NO;

Swift

mapView.isScrollEnabled = false
like image 173
Inder Kumar Rathore Avatar answered Dec 03 '25 03:12

Inder Kumar Rathore


Try to set

mapView.scrollEnabled=NO;

or set

mapView.userInteractionEnabled = NO;

but it does not allow you to zoom in or out and other things. click here for more info.

like image 35
Girish Avatar answered Dec 03 '25 02:12

Girish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!