How to return UISearchController under a title on an iPad with iOS 16?
Asked Answered
R

1

6

On iPad with iOS 16 searchController displaying on the right side. Like this: Browser style

How can I return the searchController's "default" view? Like this: UISearchController under title

Retake answered 19/9, 2022 at 16:42 Comment(0)
T
22

In iOS 16, there is a new property preferredSearchBarPlacement for the navigationItem, you can change it to .stacked to make it appear like previous iOS:

if #available(iOS 16.0, *) {
  navigationItem.preferredSearchBarPlacement = .stacked
}
Trawick answered 21/9, 2022 at 2:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.