Home:ALL Converter>UIpicker view data source

UIpicker view data source

Ask Time:2014-05-03T09:09:05         Author:Miguel

Json Formatter

I'm a IOS noob and I'm trying to understand how to set the datasource of of the uipicker view i have followed This tutorial, everything seems to work correctly however i get a warning in xcode that says

'id<UIPickerViewDataSource>' from incompatible type 'StateViewController *const __strong'

it occurs on this line.

myPickerView.delegate = self;

I keep trying different things but they all lead me in the same direction. It fails. How should i be doing this? how to i properly set the datasource of a UIpicker view.

Thanks in advance for your guidance.

Author:Miguel,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/23439108/uipicker-view-data-source
rdelmar :

You just need to tell the compiler that you're going to conform to the delegate protocol. You do that by adding <UIPickerViewDataSource> to your .h file,\n\n@interface StateViewController : UIViewController <UIPickerViewDataSource>\n",
2014-05-03T01:12:52
Zia :

You need to say \n\nmyPickerView.dataSource = self\n\n\nand also\n\n<UIPickerViewDataSource>\n",
2014-05-03T01:36:00
yy