---
title: "setShadowImage(_:forToolbarPosition:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitoolbar/setshadowimage(_:fortoolbarposition:)"
---

# setShadowImage(_:forToolbarPosition:)

Sets the image to use for the toolbar shadow in a given position.

## Declaration

```swift
func setShadowImage(_ shadowImage: UIImage?, forToolbarPosition topOrBottom: UIBarPosition)
```

## Parameters

- `shadowImage`: The image to use for the toolbar shadow in the position specified by topOrBottom.
- `topOrBottom`: A toolbar position constant. You can use this parameter to indicate whether the shadowImage is intended for a toolbar at the top or bottom of the view.

## Discussion

Discussion When the shadowImage parameter is nil, the default shadow will be used. When non-nil, the shadowImage property is a custom shadow image to show instead of the default. Using the topOrBottom parameter, you can set a different shadow for toolbars at the top and bottom of the view. For a custom shadow image to be shown, a custom background image must also be set with the setBackgroundImage(_:forToolbarPosition:barMetrics:) method. If the default background image is used, then the default shadow image will be used regardless of the value of the shadowImage parameter.

## See Also

### Adding a shadow

- [shadowImage(forToolbarPosition:)](uikit/uitoolbar/shadowimage(fortoolbarposition:).md)
