ios - 将 UiPickerView 添加到 AlertController

标签 ios swift uialertview uipickerview

我正在尝试使用内置的 UIPickerView 快速创建警报消息。

按下“测试”按钮后,选择器应该出现在警告窗口中: enter image description here

问题仅出在 UIPickerView 的数据源上。它是空的: enter image description here

项目发布在我的GIT repo 。有人可以建议如何解决它吗? 非常感谢!

最佳答案

在您的 createContainerView 函数中,将您自己指定为委托(delegate)人,如下所示:

self.currPicker.dataSource = self
self.currPicker.delegate = self

关于ios - 将 UiPickerView 添加到 AlertController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28795313/

相关文章:

iOS Swift - 当 1 个按钮覆盖另一个按钮时,为什么单击 1 个按钮会激活另一个按钮

ios - UNNotificationRequest 每天在特定时间发送本地通知

iphone - UIAlertView 单击时崩溃 - 使用 ARC

ios - 我找不到在 UIAlertView 中按下的按钮

ios - 如何显示 View ?

ios - uitableviewcells 与 3 个重叠中的前 2 个单元重叠

ios - 带有 StackView 的 UITableViewCell 不能动态调整高度

处理 HTTPRequest(JSON) 时,iOS 应用程序有时会崩溃

ios - 可达性 + UIAlertView + 误报

objective-c - iOS 应用之间同步数据有什么好的解决方案?