【发布时间】:2020-05-13 23:30:46
【问题描述】:
我正在尝试制作一个设置屏幕,其中 ViewController A 具有 MapView 和 ViewController A 具有将这些引脚放在地图上的功能。
我正在尝试读取 ViewController B 中的 UIPickerView 数据,并通过单击按钮将其发送到 ViewController A。在 ViewController A 中,另一个名为 determineCity() 的函数将评估它收到的数据。
func determineCity(){
switch incomingData {
case "0":
IzmirSelected()
break
case "1":
print("San Francisco")
default:
print("Other")
}
@IBAction func setCityButtonClicked(_ sender: Any) {
if selectedData != "-1" {
self.delegate?.SendDataToViewController(info: selectedData)
self.navigationController?.popToRootViewController(animated: true)
}
我尝试了委托方法,它不会将数据发送到 ViewController A。ViewController A 上的代码永远不会改变。
我可以尝试做些什么来将此数据发送到 ViewController A。我做错了什么?
感谢您的帮助!
【问题讨论】: