2013-02-21 112 views
2

我在我的应用程序中使用MKMapView,并使用mapView.scrollEnabled=NO;,但它不起作用。这里是我的代码:如何停止在mkmapview中滚动?

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

我的代码有什么问题吗?

回答

10

你已经在你的代码中使用YES代替NO。请按如下所示使用NO

mapView.scrollEnabled = NO; 
+0

我都试过了,但简化版,工作。 – San 2013-02-21 14:29:49

+0

@San它在我的测试项目中工作。 – 2013-02-21 14:35:12

2

尝试将MKMapViewuserInteractionEnabled属性设置为NO

mapView.userInteractionEnabled = NO; 
2

尝试设置

mapView.scrollEnabled=NO; 

或设置

mapView.userInteractionEnabled = NO; 

但它不会让你或缩小和其他东西放大。 点击here了解更多信息。