ios - iOS8 UISearchController Covers Up UITableView -
i've implemented 1uisearchcontroller1 tableview, scopes , everything. doesn't display correctly when view loads initially.
there 4 different things see depending on actions.
this see when view first appears. wouldn't expect scope bar appear:

now, if click on search bar, see this:

next, if click on cancel button again, see on table view:

finally, if tap on search bar again, see expect when tapped on search bar first time:

and if cancel 1 more time, search bar displays correctly on table view:

here's relevant part of tableviewcontroller.
class basewinetableviewcontroller: uitableviewcontroller, uitableviewdelegate, uinavigationcontrollerdelegate, uitableviewdatasource, uisearchresultsupdating, uisearchbardelegate, uisearchcontrollerdelegate { var resultsearchcontroller = uisearchcontroller() func configuresearchcontroller() { self.resultsearchcontroller = uisearchcontroller(searchresultscontroller: nil) self.resultsearchcontroller.searchresultsupdater = self self.resultsearchcontroller.searchbar.delegate = self self.resultsearchcontroller.delegate = self self.resultsearchcontroller.searchbar.showscancelbutton = true self.resultsearchcontroller.searchbar.autocapitalizationtype = .none self.resultsearchcontroller.searchbar.showsscopebar = true self.resultsearchcontroller.searchbar.scopebuttontitles = ["all", cellar_statuses.cellared, cellar_statuses.wishlist, cellar_statuses.finished] self.resultsearchcontroller.definespresentationcontext = true self.resultsearchcontroller.dimsbackgroundduringpresentation = false self.tableview.tableheaderview = resultsearchcontroller.searchbar } override func viewdidload() { super.viewdidload() configuresearchcontroller() }
i figured out. when removed line:
self.resultsearchcontroller.searchbar.showsscopebar = true but left in line defines scope titles, fixed it.
Comments
Post a Comment