---
title: NSStringDrawingContext
framework: uikit
role: symbol
role_heading: Class
path: uikit/nsstringdrawingcontext
---

# NSStringDrawingContext

An object that manages metrics for drawing attributed strings.

## Declaration

```swift
class NSStringDrawingContext
```

## Overview

Overview Prior to drawing, you can create an instance of this class and use it to specify the minimum scale factor and tracking adjustments for a string. After drawing, you can retrieve the actual values that were used during drawing. To use this class, allocate and initialize a new instance, set the minimum values, and pass your object to one of the corresponding NSAttributedString methods that take the context object as a parameter. Upon completion of drawing, you can use the actual drawing values to make adjustments or record where the string was actually drawn.

## Topics

### Accessing the scale factors

- [minimumScaleFactor](uikit/nsstringdrawingcontext/minimumscalefactor.md)
- [actualScaleFactor](uikit/nsstringdrawingcontext/actualscalefactor.md)

### Getting the drawing bounds

- [totalBounds](uikit/nsstringdrawingcontext/totalbounds.md)

### Deprecated

- [minimumTrackingAdjustment](uikit/nsstringdrawingcontext/minimumtrackingadjustment.md)
- [actualTrackingAdjustment](uikit/nsstringdrawingcontext/actualtrackingadjustment.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Strings

- [NSStringDrawingOptions](uikit/nsstringdrawingoptions.md)
- [UIBaselineAdjustment](uikit/uibaselineadjustment.md)
