If I have an protocol (say UIPickerViewDataSource) and I implement its required methods, do I need to declare those methods in the header file of my class?
At the moment I’m not doing so and I get a warning of incomplete implementation (although everything works fine). If I do add the required methods in the then I don’t get such warning:
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView;
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component;
Is this the correct behaviour? Is it really necessary to add the declaration for required protocol methods in the header file of my class?
No, you don’t. Declaring that the class implements that protocol and implementing the methods is enough. You could still declare them in the header for documentation purposes, though.