---
title: "setWhiteBalanceModeLocked(whiteBalanceTemperatureAndTintValues:handler:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturedevice/setwhitebalancemodelocked(whitebalancetemperatureandtintvalues:handler:)"
---

# setWhiteBalanceModeLocked(whiteBalanceTemperatureAndTintValues:handler:)

Sets white balance to locked mode with explicit temperature and tint values.

## Declaration

```swift
func setWhiteBalanceModeLocked(whiteBalanceTemperatureAndTintValues: AVCaptureDevice.WhiteBalanceTemperatureAndTintValues, handler: ((CMTime) -> Void)? = nil)
```

## Parameters

- `whiteBalanceTemperatureAndTintValues`: The white balance temperature and tint values, as computed from doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/temperatureAndTintValues(for:) method, doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/WhiteBalanceTemperatureAndTintValues presets or manual input.
- `handler`: A block to be called when white balance values have been set to the values specified and doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/whiteBalanceMode-swift.property is set to AVCaptureWhiteBalanceModeLocked. If doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureDevice/setWhiteBalanceModeLocked(whiteBalanceTemperatureAndTintValues:handler:) is called multiple times, the completion handlers are called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureSession/synchronizationClock prior to comparison with the timestamps of buffers delivered via an doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureVideoDataOutput. This parameter may be nil if synchronization is not required.

## Discussion

Discussion This method takes a AVCaptureDevice.WhiteBalanceTemperatureAndTintValues struct and applies the appropriate AVCaptureDevice.WhiteBalanceGains. This method throws an NSRangeException if any of the values are set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the device using lockForConfiguration().

## See Also

### Setting white balance manually

- [isLockingWhiteBalanceWithCustomDeviceGainsSupported](avfoundation/avcapturedevice/islockingwhitebalancewithcustomdevicegainssupported.md)
- [setWhiteBalanceModeLocked(with:completionHandler:)](avfoundation/avcapturedevice/setwhitebalancemodelocked(with:completionhandler:).md)
