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

# position(for:)

Asks the delegate for the position of the specified bar in its new window.

```
optional func position(for bar: any UIBarPositioning) -> UIBarPosition
```

## Parameters

`bar`

The bar that was added to the window.

## Return Value

The position of the bar.

## Discussion

If your interface has a custom bar with a delegate, that delegate can implement this method and use it to specify the position of the bar that has been added to a window.

Delegates for the [`UINavigationBar`](/documentation/UIKit/UINavigationBar) and [`UISearchBar`](/documentation/UIKit/UISearchBar) classes return the value [`UIBarPosition.top`](/documentation/UIKit/UIBarPosition/top) by default. The delegate of the [`UIToolbar`](/documentation/UIKit/UIToolbar) class returns the value [`UIBarPosition.bottom`](/documentation/UIKit/UIBarPosition/bottom) by default.

## See Also

[`protocol UIBarPositioning`](/documentation/UIKit/UIBarPositioning)

A set of methods for defining the positioning of bars in iOS apps.



---

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)