swift - How to get search bar background transparant?(see image) -
i using searchcontroller in view, can not rid of annoying background of searchbar.
the code using:
import uikit class systemtable: uitableviewcontroller, uisearchbardelegate , uisearchresultsupdating{ @iboutlet var systemtable: uitableview! var searchcontroller = uisearchcontroller() override func viewdidload() { super.viewdidload() self.searchcontroller = ({ let controller = uisearchcontroller(searchresultscontroller: nil) controller.searchresultsupdater = self controller.searchbar.sizetofit() controller.searchbar.delegate = self controller.searchbar.bartintcolor = uicolor.lightgraycolor() controller.searchbar.translucent = true controller.searchbar.alpha = 1 controller.searchbar.backgroundcolor = uicolor.clearcolor() controller.searchbar.layer.opacity = 1 self.tableview.tableheaderview = controller.searchbar return controller })() }
to clear: want rid of background colored gray in image above.
any appreciated
@@@@@@@@@@@@@@@@@ edit @@@@@@@@@@@@@@@@@ new image(when trying scrolling down):
its working fine me, sure r close solution. try somewhere u r missing.
here code
searchcontroller.searchbar.translucent = true searchcontroller.searchbar.alpha = 1 searchcontroller.searchbar.backgroundimage = uiimage() searchcontroller.searchbar.bartintcolor = uicolor. clearcolor()
Comments
Post a Comment