What happens when the screen transitions in the tab bar while searching in the swift UISearchController?

Asked 2 years ago, Updated 2 years ago, 47 views

I use the UISearchController to display the search bar.

After viewing the table view search results from the search bar, go to the UITabBarController tab bar and transition to
After that, when you return to the original search screen, only the search bar is displayed and the screen is completely dark.

·Screen A (Search Results Display)
·Screen B (Other screens)

Screen A (Search Results Display) → Screen B → Screen A (Screen is completely dark)
画面The screen transition is carried out on the tab bar

"Also, I wrote ""viewWillAppear"" on screen A, such as reloadData, but
ViewWillAppear (also viewWillDisappear) when displaying search results
does not appear to run.
ViewWillAppear will run if you are not searching.

Could you tell me how to improve it?

Screen displaying search results before screen transition
Screen B→After Screen A

swift xcode

2022-09-30 16:00

1 Answers

Self-resolved.

After adding ↓ to viewDidLoad before transition, it became normal.
definePresentationContext=true


2022-09-30 16:00

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.