<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextView/setLayoutOrientation(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextView(im)setLayoutOrientation:"
  },
  "title" : "setLayoutOrientation(_:)"
}
-->

# setLayoutOrientation(_:)

Changes the receiver’s layout orientation and invalidates the contents.

```
func setLayoutOrientation(_ orientation: NSLayoutManager.TextLayoutOrientation)
```

## Parameters

`orientation`

The text layout orientation.

## Discussion

Unlike other `NSTextView` properties, this is not shared by sibling views.  It also rotates the bounds 90 degrees, swaps horizontal and vertical bits of the [`autoresizingMask`](/documentation/AppKit/NSView/autoresizingMask-swift.property) mask, and reconfigures [`isHorizontallyResizable`](/documentation/AppKit/NSText/isHorizontallyResizable) and [`isVerticallyResizable`](/documentation/AppKit/NSText/isVerticallyResizable) properties accordingly.  Also, if [`enclosingScrollView`](/documentation/AppKit/NSView/enclosingScrollView) returns non-`nil`, it reconfigures the horizontal and vertical ruler views, the horizontal and vertical scrollers, and the frame.

---

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)