<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableViewDelegate/indexPathForPreferredFocusedView(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITableViewDelegate(im)indexPathForPreferredFocusedViewInTableView:"
  },
  "title" : "indexPathForPreferredFocusedView(in:)"
}
-->

# indexPathForPreferredFocusedView(in:)

Asks the delegate for the table view’s index path for the preferred focused view.

```
optional func indexPathForPreferredFocusedView(in tableView: UITableView) -> IndexPath?
```

## Parameters

`tableView`

A table view requesting the index path for preferred focus view.

## Return Value

An index path for the preferred focus row, or the default preferred focus view.

## Discussion

This functionality of this delegate method is equivalent to overriding [`UITableView`](/documentation/UIKit/UITableView) class’s [`preferredFocusedView`](/documentation/UIKit/UIFocusGuide/preferredFocusedView) method in the [`UIFocusEnvironment`](/documentation/UIKit/UIFocusEnvironment) protocol. If the [`UITableView`](/documentation/UIKit/UITableView) class’s [`remembersLastFocusedIndexPath`](/documentation/UIKit/UITableView/remembersLastFocusedIndexPath) method is set to <doc://com.apple.documentation/documentation/Swift/true>, this method defines the index path that gets focused when the table view is focused for the first time.

The effects of this method may be ignored during or immediately after a view controller transition, such as a presentation dismissal or navigation stack pop. In such cases, the view controller attempts to restore focus to the item that was focused prior to the transition (for example, prior to the view controller being presented or pushed), which can take precedence over the effects of this method. To learn how to control or disable this behavior in the view controller, see [`restoresFocusAfterTransition`](/documentation/UIKit/UIViewController/restoresFocusAfterTransition).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)