---
title: "pickerView(_:titleForRow:forComponent:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uipickerviewdelegate/pickerview(_:titleforrow:forcomponent:)"
---

# pickerView(_:titleForRow:forComponent:)

Called by the picker view when it needs the title to use for a given row in a given component.

## Declaration

```swift
optional func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String?
```

## 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 pickerView. Components are numbered left-to-right.

## Return Value

Return Value The string to use as the title of the indicated component row.

## Discussion

Discussion If you implement both this method and the pickerView(_:attributedTitleForRow:forComponent:) method, the picker view prefers the pickerView(_:attributedTitleForRow:forComponent:) method. However, if that method returns nil, the picker view falls back to using the string returned by this method.

## See Also

### Setting the content of component rows

- [pickerView(_:attributedTitleForRow:forComponent:)](uikit/uipickerviewdelegate/pickerview(_:attributedtitleforrow:forcomponent:).md)
- [pickerView(_:viewForRow:forComponent:reusing:)](uikit/uipickerviewdelegate/pickerview(_:viewforrow:forcomponent:reusing:).md)
