San
San

Reputation: 247

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?

Upvotes: 2

Views: 4670

Answers (3)

Inder Kumar Rathore
Inder Kumar Rathore

Reputation: 39978

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

mapView.scrollEnabled = NO;

Swift

mapView.isScrollEnabled = false

Upvotes: 15

Girish
Girish

Reputation: 4712

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.

Upvotes: 3

Andrea Mario Lufino
Andrea Mario Lufino

Reputation: 7921

Try to set userInteractionEnabled property of MKMapView to NO.

mapView.userInteractionEnabled = NO;

Upvotes: 2

Related Questions