Swift3 如何将google Placepicker位置保存到tableviewcell?

Swift3 如何将google Placepicker位置保存到tableviewcell?,swift3,ios10,xcode8,Swift3,Ios10,Xcode8,我已经编写了这段代码,我希望每次从位置选择器中选择位置时,都将选择器位置保存到tableview单元格中 到目前为止,只有一个地方,我可以保存。我试过在谷歌上搜索,但其他东西都没有找到正确的答案。有人能帮我吗 class SetLocationLocationsVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate { @IBOutlet weak var setLocatio

我已经编写了这段代码,我希望每次从位置选择器中选择位置时,都将选择器位置保存到tableview单元格中

到目前为止,只有一个地方,我可以保存。我试过在谷歌上搜索,但其他东西都没有找到正确的答案。有人能帮我吗

class SetLocationLocationsVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate {


@IBOutlet weak var setLocationImagePin: UIImageView!
@IBOutlet weak var ClearLabel: UILabel!
@IBOutlet weak var DeleteButton: UIButton!
@IBOutlet weak var SetLocationView: UIView!
@IBOutlet weak var PickUpLocationButton: UIButton!
@IBOutlet weak var AddressTextField: UITextField!
@IBOutlet weak var LocationButton: UIButton!
@IBOutlet weak var NameLabel: UILabel!
@IBOutlet weak var tableViewForLocations: UITableView!
var placesClient: GMSPlacesClient!
    override func viewDidLoad() {
        super.viewDidLoad()
        placesClient = GMSPlacesClient.shared()
        AddressTextField.isHidden = true
        tableViewForLocations.delegate = self
        tableViewForLocations.dataSource = self
        AddressTextField.delegate = self
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()

    }
    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
    self.view.endEditing(true)
    return false
}

@IBAction func PickPlace(_ sender: Any) {

    let center = CLLocationCoordinate2D(latitude: 37.788204, longitude: -122.411937)
    let northEast = CLLocationCoordinate2D(latitude: center.latitude + 0.001, longitude: center.longitude + 0.001)
    let southWest = CLLocationCoordinate2D(latitude: center.latitude - 0.001, longitude: center.longitude - 0.001)
    let viewport = GMSCoordinateBounds(coordinate: northEast, coordinate: southWest)
    let config = GMSPlacePickerConfig(viewport: viewport)
    let placePicker = GMSPlacePicker(config: config)
    AddressTextField.isHidden = false

    placePicker.pickPlace(callback: {(place, error) -> Void in
        if let error = error {
            print("Pick Place error: \(error.localizedDescription)")
            return
        }

        if let place = place {
                self.NameLabel.text = place.formattedAddress?.components(separatedBy: ", ")
                .joined(separator: "\n")
        } else {

            self.NameLabel.text = ""
        }
    })
}
@IBAction func SetLocationClicked(_ sender: Any) {
   tableViewForLocations.reloadData()
   AddressTextField.isHidden = true

    }
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableViewForLocations.dequeueReusableCell(withIdentifier: "mycell", for: indexPath) as! LocationCell
    cell.Label1.text = AddressTextField.text
    cell.Label2.text = NameLabel.text
    tableViewForLocations.register(UITableViewCell.self, forCellReuseIdentifier: "mycell")
    return cell
}

@IBAction func DeleteClicked(_ sender: Any) {

}
}