我的汽车完成有什么问题?

时间:2018-04-12 06:00:42

标签: swift google-maps autocomplete google-places-api

`你好☺️我是swift的新手。我正在谷歌地图和Goole Place工作。 我有一个搜索栏,当我点击按钮并搜索结果应显示在一个自动完成位置,但这不起作用。 这是我的代码:

func viewController(_ viewController: GMSAutocompleteViewController, didAutocompleteWith place: GMSPlace) {
    let camera = GMSCameraPosition.camera(withLatitude: place.coordinate.latitude, longitude: place.coordinate.longitude, zoom: 15.0)
    self.googleMapsView.camera = camera
    self.dismiss(animated: true, completion: nil) //dismiss after select place
}

func viewController(_ viewController: GMSAutocompleteViewController, didFailAutocompleteWithError error: Error) {
    print("Erroe Auto Complte \(error)")
}
func wasCancelled(_ viewController: GMSAutocompleteViewController) {
    self.dismiss(animated: true, completion: nil)//when cancel search

}

@IBAction func openSearchAddress(_ sender: UIBarButtonItem) {
    let autoCompleteController = GMSAutocompleteViewController()
    autoCompleteController.delegate = self
    self.locationManager.startUpdatingLocation()
    self.present(autoCompleteController, animated: true, completion: nil)
}

1 个答案:

答案 0 :(得分:0)

<Swipeout {...swipeSettings}>
   <View style={styles.swipeStyle}>
      <View style={styles.buttonContainer}>
          <MinusButton />
      </View>
      <View style={styles.itemStyle}>
          <Text>{this.props.name}</Text>
      </View>
      <View style={styles.buttonContainer}>
           <PlusButton />
      </View>
   </View>
</Swipeout>
  

使用locationStart和locationEnd可以绘制折线