我在我的应用程序中使用
MKMapView
并使用 mapView.scrollEnabled=NO;
但它不起作用。这是我的代码:
mapView=[[MKMapView alloc] initWithFrame:CGRectMake(20, 100, 282, 209)];
mapView.delegate=self;
mapView.scrollEnabled=YES;
[self.view addSubview:mapView];
我的代码有问题吗?
您在代码中使用了
YES
而不是 NO
。请使用如下NO
。
mapView.scrollEnabled = NO;
斯威夫特
mapView.scrollEnabled = false
尝试设置
mapView.scrollEnabled=NO;
或设置
mapView.userInteractionEnabled = NO;
但它不允许您放大或缩小以及其他操作。 单击此处了解更多信息。
尝试将
userInteractionEnabled
的 MKMapView
属性设置为 NO
。
mapView.userInteractionEnabled = NO;