2013-02-21 116 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瞭解更多信息。