---
title: contentMode
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uiview/contentmode-swift.property
---

# contentMode

A flag used to determine how a view lays out its content when its bounds change.

## Declaration

```swift
var contentMode: UIView.ContentMode { get set }
```

## Discussion

Discussion The content mode specifies how the cached bitmap of the view’s layer is adjusted when the view’s bounds change. This property is often used to implement resizable controls. Instead of redrawing the contents of the view every time, you can use this property to specify that you want to scale the contents (either with or without distortion) or pin them to a particular spot on the view. note: You can always force the contents of a view to be redrawn by calling the setNeedsDisplay() or setNeedsDisplay(_:) method. For a list of values you can assign to this property, see UIView.ContentMode. The default value of this property is UIView.ContentMode.scaleToFill.

## See Also

### Configuring the resizing behavior

- [UIView.ContentMode](uikit/uiview/contentmode-swift.enum.md)
- [sizeThatFits(_:)](uikit/uiview/sizethatfits(_:).md)
- [sizeToFit()](uikit/uiview/sizetofit().md)
- [autoresizesSubviews](uikit/uiview/autoresizessubviews.md)
- [autoresizingMask](uikit/uiview/autoresizingmask-swift.property.md)
