我正在和欧洲各国首都做一个测试,地图将移动到特定的国家,我不希望用户滚动并看到首都的名称。所以基本上我有两个选择,我需要帮助:1。不允许用户滚动
2。在谷歌地图中隐藏所有首都或城市
代码如下:

  switch(randomNumber) {

        case 1:

        let latitude:Double = 45.943161
        let longitude:Double = 24.966760000000022

        let span = MKCoordinateSpanMake(25, 25)
        let region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: latitude, longitude: longitude), span: span)

        mapView.setRegion(region, animated: true)

        let pinLocation: CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)

        let objectAnn = MKPointAnnotation()
        objectAnn.coordinate = pinLocation

        self.mapView.addAnnotation(objectAnn)




        questionLabel.text = "Iceland"
        button1.setTitle("Copenhagen", for: UIControlState.normal)
        button2.setTitle("Reykiavik", for: UIControlState.normal)
        button3.setTitle("Oslo", for: UIControlState.normal)
        button4.setTitle("Ljubiana", for: UIControlState.normal)

        correctAnswer = "2"

        break

最佳答案

类似的MapKitquestion用于用户交互
要删除大写字母,可以尝试Apple的MapKit文档:showsPointsOfInterest
另外,看起来你使用的是苹果的地图套件,而不是谷歌地图,仅供参考。

09-16 20:25