<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UILayoutSupport/length",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UILayoutSupport(py)length"
  },
  "title" : "length"
}
-->

# length

Provides the length, in points, of the portion of a view controller’s view that is overlaid by translucent or transparent UIKit bars.

```
var length: CGFloat { get }
```

## Discussion

In iOS 7 and later, a view controller’s view occupies the full height of the screen when there are no opaque UIKit bars (such as opaque navigation or tab bars). To keep your content within the area of a view that is not overlaid by translucent or transparent UIKit bars, employ the [`topLayoutGuide`](/documentation/UIKit/UIViewController/topLayoutGuide) and [`bottomLayoutGuide`](/documentation/UIKit/UIViewController/bottomLayoutGuide) properties in the [`UIViewController`](/documentation/UIKit/UIViewController) class and take advantage of Auto Layout. Query these properties within your implementation of the [`UIViewController`](/documentation/UIKit/UIViewController) method [`viewDidLayoutSubviews()`](/documentation/UIKit/UIViewController/viewDidLayoutSubviews()).

The guides work as follows:

- The top layout guide indicates the distance, in points, between the top of a view controller’s view and the bottom of the bottommost bar that overlays the view
- The bottom layout guide indicates the distance, in points, between the bottom of a view controller’s view and the top the bar (such as a tab bar) that overlays the view.

If you are not using Auto Layout, you can make use of the [`length`](/documentation/UIKit/UILayoutSupport/length) property and perform layout calculations yourself. Refer to the code snippets in the descriptions for the [`topLayoutGuide`](/documentation/UIKit/UIViewController/topLayoutGuide) and [`bottomLayoutGuide`](/documentation/UIKit/UIViewController/bottomLayoutGuide) properties, which explain how to obtain the numbers you need.

---

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)