<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/NSLayoutManagerDelegate",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSLayoutManagerDelegate"
  },
  "title" : "NSLayoutManagerDelegate"
}
-->

# NSLayoutManagerDelegate

A set of optional methods that delegates of layout manager objects implement.

```
protocol NSLayoutManagerDelegate : NSObjectProtocol
```

## Topics

### Invalidating glyphs and layout

[`-  layoutManagerDidInvalidateLayout:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManagerDidInvalidateLayout(_:))

Informs the delegate when the specified layout manager invalidates layout information (not glyph information).

[`-  layoutManager:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:shouldGenerateGlyphs:properties:characterIndexes:font:forGlyphRange:))

Enables customization of the initial glyph generation process.

[`-  layoutManager:shouldUseAction:forControlCharacterAtIndex:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:shouldUse:forControlCharacterAt:))

Returns the control character action for the control character at the specified character index.

[`ControlCharacterAction`](/documentation/UIKit/NSLayoutManager/ControlCharacterAction)

Constants that describe actions for control characters.

### Responding to text container layout

[`-  layoutManager:didCompleteLayoutForTextContainer:atEnd:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:didCompleteLayoutFor:atEnd:))

Informs the delegate when the layout manager finishes laying out text in the specified text container.

[`-  layoutManager:textContainer:didChangeGeometryFromSize:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:textContainer:didChangeGeometryFrom:))

Informs the delegate when the layout manager invalidates layout due to a change in the geometry of the specified text container.

### Handling line fragments

[`-  layoutManager:shouldBreakLineByHyphenatingBeforeCharacterAtIndex:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:shouldBreakLineByHyphenatingBeforeCharacterAt:))

Asks the delegate whether to break the line at the specified character.

[`-  layoutManager:shouldBreakLineByWordBeforeCharacterAtIndex:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:shouldBreakLineByWordBeforeCharacterAt:))

Asks the delegate whether to break the line at the specified word.

[`-  layoutManager:lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:lineSpacingAfterGlyphAt:withProposedLineFragmentRect:))

Returns the amount of space to add to the end of a line.

[`-  layoutManager:paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:paragraphSpacingAfterGlyphAt:withProposedLineFragmentRect:))

Returns the amount of space to add at the end of a paragraph.

[`-  layoutManager:paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:paragraphSpacingBeforeGlyphAt:withProposedLineFragmentRect:))

Returns the amount of space to add at the beginning of a paragraph.

[`-  layoutManager:boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:boundingBoxForControlGlyphAt:for:proposedLineFragment:glyphPosition:characterIndex:))

Returns the bounding rectangle for the specified control glyph with the specified parameters.

[`-  layoutManager:shouldSetLineFragmentRect:lineFragmentUsedRect:baselineOffset:inTextContainer:forGlyphRange:`](/documentation/UIKit/NSLayoutManagerDelegate/layoutManager(_:shouldSetLineFragmentRect:lineFragmentUsedRect:baselineOffset:in:forGlyphRange:))

Customizes the line fragment geometry before committing it to the layout cache.

### Managing temporary attribute support

  <doc://com.apple.documentation/documentation/AppKit/NSLayoutManagerDelegate/layoutManager(_:shouldUseTemporaryAttributes:forDrawingToScreen:atCharacterIndex:effectiveRange:)>

### Deprecated

[Control Characters](/documentation/UIKit/1619233-control-characters)

Constants that describe actions for control characters.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)