Type “myViewController” does not conform to protocol UIPIckerDataSource in Swift

前端 未结 5 706
盖世英雄少女心
盖世英雄少女心 2020-12-13 23:50

I just create a new class in Swift, it\'s called myViewController and it\'s a UIViewController. Now I\'m trying to make it a UIPickerViewDelegate

5条回答
  •  时光说笑
    2020-12-14 00:27

    You need to implement all the required methods of UIPickerViewDataSource and UIPickerViewDelegate, if you want to conform to these protocols.

    Swift is more like java when it comes to protocols because if you don't implement all the required methods declared by a protocol you are going to get a compile time error instead of a run time exception.

提交回复
热议问题