SFSafariViewControllerを使用しています。私はサファリのステータスバーを表示したくないため、オーバーレイを追加して非表示にしています。オーバーレイに自分のボタンがあり、その上手く動作しています。サファリステータスバーは表示されず、オーバーレイが表示されますが、オーバーレイが消えてサファリステータスバーが表示されることがあります。私はそのリンクが自動的に再読み込みされているので、その方法を疑う?私はそれを一度しか呼びません。オーバーレイがなぜ時々だけ消えるのか分かりません。以下は私のコードです -SFSafariViewController:オーバーレイが表示されない場合があります
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") as UIImage?
let homeBtn = UIButton(type: UIButtonType.Custom) as 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 as 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 as 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)
})
私は長い間、この問題で長続きしていません。ありがとう!
私はWebビューを使用できないシナリオがあります。私はそれのためにサファリを使用しなければならなかった。 –