Called by the picker view when it needs the title to use for a given row in a given component.
SDKs
- iOS 2.0+
- Mac Catalyst 13.0+
Framework
- UIKit
Declaration
- (NSString *)pickerView:(UIPicker View *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component;
Parameters
pickerView
An object representing the picker view requesting the data.
row
A zero-indexed number identifying a row of
component
. Rows are numbered top-to-bottom.component
A zero-indexed number identifying a component of
picker
. Components are numbered left-to-right.View
Return Value
The string to use as the title of the indicated component row.
Discussion
If you implement both this method and the picker
method, the picker view prefers the picker
method. However, if that method returns nil
, the picker view falls back to using the string returned by this method.