Hi team, while i am using below code, i am getting two searchBar at top & bottom. Kindly refer below code & attached image
Code:
override func viewDidLoad() {
super.viewDidLoad()
title = "Test Data"
setupSearchData()
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.setupSearchData()
}
}
func setupSearchData() {
navigationController?.navigationBar.prefersLargeTitles = false
let searchController = UISearchController(searchResultsController: nil)
navigationItem.searchController = searchController
}
It is working fine for other iOS versions. In my real useCase, i will refresh screen after API completed, then this issue occurred in my app.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi team, in iOS latest version 26.0, we are getting searchBar at bottom of the screen. Is there any option to change the position of the search? I need to move it to top as like in previous iOS version.
I am using below code to change navigationBar bg colour, but the text is hidden in large title. It works fine in previous versions. Kindly refer below code and attached images.
Code:
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.largeTitleDisplayMode = .always
let appearance = UINavigationBarAppearance()
appearance.backgroundColor = UIColor(
red: 0.101961,
green: 0.439216,
blue: 0.388235,
alpha: 1.0
)
navigationController?.navigationBar.standardAppearance = appearance
navigationController?.navigationBar.scrollEdgeAppearance = appearance
navigationController?.navigationBar.compactAppearance = appearance
}
Referenced images:
I have attached two images of two screens below. In one screen, bar button are enclosed within separate, distinct, rounded-rectangle 'liquid glass' capsules. In other screen, bar buttons are enclosed within separate, distinct, rounded-rectangle "liquid glass" capsules. They are not visually merged into one larger capsule.
Both are having same code. But why it is not same ?