ios - SFSafariViewController : Overlay is not appearing sometimes -
i using sfsafariviewcontroller, , did not wanted show status bar of safari , have hidden adding overlay. have own button on overlay , working fine. safari status bar hidden , shows overlay somehow overlay disappears , safari status bar visible. doubt because link being reloaded automatically how? calling once. not sure why overlay disappear only. below code -
self.navigationcontroller?.presentviewcontroller(sfcontroller!, animated: true, completion: { let bounds = uiscreen.mainscreen().bounds let overlay = uiview(frame: cgrect(x: 0, y: 0, width: bounds.size.width, height: 65)) overlay.backgroundcolor = uicolor(nethex: 0x275e37) let completedbtn = uibutton() let favbtn = uibutton() let image = uiimage(named: "home.png") uiimage? let homebtn = uibutton(type: uibuttontype.custom) uibutton homebtn.frame = cgrectmake(20, 25, 35, 35) homebtn.setimage(image, forstate: .normal) homebtn.addtarget(self, action: #selector(detailsviewcontroller.homebtnaction), forcontrolevents:.touchupinside) completedbtn.settitle("mark completed",forstate: .normal) completedbtn.titlelabel!.font = uifont(name: "fidelitysans-regular", size: 20) completedbtn.settitlecolor(uicolor.whitecolor(), forstate: .normal) completedbtn.frame = cgrectmake((bounds.size.width - 210), 25, 200, 35) completedbtn.backgroundcolor = uicolor(nethex: 0x6f9824) completedbtn.addtarget(self, action: #selector(detailsviewcontroller.completedaction), forcontrolevents: uicontrolevents.touchupinside) favbtn.settitle("save favorite", forstate: .normal) favbtn.titlelabel!.font = uifont(name: "fidelitysans-regular", size: 20) favbtn.settitlecolor(uicolor.whitecolor(), forstate: .normal) favbtn.frame = cgrectmake((bounds.size.width - 420), 25, 200, 35) favbtn.backgroundcolor = uicolor(nethex: 0x6f9824) favbtn.addtarget(self, action: #selector(detailsviewcontroller.favoriteaction), forcontrolevents: uicontrolevents.touchupinside) overlay.addsubview(favbtn) overlay.addsubview(completedbtn) overlay.addsubview(homebtn) self.sfcontroller!.view.addsubview(overlay) })
any appreciated stuck in issue long time , cant fine solution. thanks!
what trying not allowed. sfsafariviewcontroller should presented is.
instead, use wkwebview build in-app browser , add custom controls.
Comments
Post a Comment