---
title: automaticallyShowsCancelButton
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uisearchcontroller/automaticallyshowscancelbutton
---

# automaticallyShowsCancelButton

A Boolean indicating whether the search controller manages the visibility of the search bar’s cancel button.

## Declaration

```swift
var automaticallyShowsCancelButton: Bool { get set }
```

## Discussion

Discussion By default, UISearchController shows the search bar’s cancel button when search becomes active and hides it when the user dismisses search. You can take over responsibility for showing and hiding the cancel button by setting this property to false. If you set the search bar’s showsCancelButton property, this property becomes false.

## See Also

### Configuring the search interface

- [obscuresBackgroundDuringPresentation](uikit/uisearchcontroller/obscuresbackgroundduringpresentation.md)
- [hidesNavigationBarDuringPresentation](uikit/uisearchcontroller/hidesnavigationbarduringpresentation.md)
- [automaticallyShowsSearchResultsController](uikit/uisearchcontroller/automaticallyshowssearchresultscontroller.md)
- [showsSearchResultsController](uikit/uisearchcontroller/showssearchresultscontroller.md)
- [searchBarPlacement](uikit/uisearchcontroller/searchbarplacement.md)
- [ignoresSearchSuggestionsForSearchBarPlacementStacked](uikit/uisearchcontroller/ignoressearchsuggestionsforsearchbarplacementstacked.md)
- [automaticallyShowsScopeBar](uikit/uisearchcontroller/automaticallyshowsscopebar.md)
- [scopeBarActivation](uikit/uisearchcontroller/scopebaractivation-swift.property.md)
- [UISearchController.ScopeBarActivation](uikit/uisearchcontroller/scopebaractivation-swift.enum.md)
