swift - UISearch Bar prompt overlaps with status bar while presenting as UISearchController -
code presenting searchcontroller:
searchcontroller = uisearchcontroller(searchresultscontroller:viewcontroller) storagelocation.tableview.tableheaderview = searchcontroller.searchbar searchcontroller.dimsbackgroundduringpresentation = true searchcontroller.hidesnavigationbarduringpresentation = true searchcontroller.searchbar.prompt = "some random text" self.definespresentationcontext = true searchcontroller.searchbar.backgroundcolor = .white self.present(searchcontroller, animated: true, completion: nil)
i think storagelocation spacing top -20. when set constraints in storyboard, don't alarmed padding @ top (even thou set 0 spacing), that's status bar.
options:
set storagelocation top spacing 0 instead of -20
hide status bar
to hide status bar, include @ bottom of vc:
override var prefersstatusbarhidden: bool { return true } in info.plist set key "uirequiresfullscreen" yes.
in project settings -> target -> general (where set app name, bundle identifier, signings etc), @ deployment info, make sure "hide status bar selected"

Comments
Post a Comment