1

UIPickerViewDataSource每当我以这种方式添加时,使用 Xcode6 beta 7

class MyClassVC: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {

它给了我一个编译错误说

"Type MyClassVC does not conform to protocol UIPickerViewDataSource"

显然它适用于 Beta 6,有人遇到过这个问题吗?

4

1 回答 1

4

Xcode 6 beta 6 和 Xcode 6 beta 7 之间的各种UIPickerViewDelegateUIPickerViewDataSource方法声明已更改。为什么?大多数隐式展开的 Optional 参数已替换为 Optional 或 Non Optional 参数。

例如,以下声明:

func pickerView(_: UIPickerView!, titleForRow row: Int, forComponent component: Int) -> String! {
    return "Hello"
}

就是现在:

func pickerView(_: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
    return "Hello"
}    

检查您的不同UIPickerViewDelegateUIPickerViewDataSource方法声明UIViewControllers

于 2014-09-06T13:08:53.600 回答