当 uitableviewcell 中 uipickerview 的值发生变化时,我需要在 viewcontroller 中更新标签

标签 swift uitableview uipickerview viewcontroller

我在 tableviewcell 中有一个 uipickerview。单元格是动态创建的。当 uipickviewer 中的值发生更改时,它会自动更新 viewcontroller 中的标签,但我无法做到这一点。那么如何在viewcontroller中获取uipickerview的值。非常感谢任何帮助。

最佳答案

在您的 View Controller 中实现 UIPickerViewDelegate,然后将选取器的委托(delegate)设置为 VC。

When the picker changes, the delegate's pickerView(_:didSelectRow:inComponent:) will be called.

关于当 uitableviewcell 中 uipickerview 的值发生变化时,我需要在 viewcontroller 中更新标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44070003/

相关文章:

ios - 单击 UITableViewCell 时打开新的 UIViewController?

arrays - 将更新的数组数据传递给 uipickerview

ios - 如何知道 ViewModel 中单个 map 的完成?

ios - 从 coreData 加载图像时崩溃

ios - swift 1.2 上的 RACCommand 编译失败

ios - 从 heightForRowAtIndexPath 中调用 cellForRowAtIndexPath — 替代?

ios - 谁能告诉我为什么我在执行此代码(Swift)时收到错误的身份验证错误?

ios - 表格 View 单元格的自动大小似乎在标准 UIViewController 类中不起作用

ios - UIPickerView 有两行

ios - 在 Objective-C 中填充字符串数组的最佳方法