點擊我的imageView後,如何隱藏導航欄,一旦點擊了我的imageView,導航欄就會弄亂全屏圖像的視圖,我希望隱藏圖像被點擊並在圖像被解散後重新出現。這是我的代碼爲我的圖像被挖掘。如何在點擊圖像時隱藏導航欄
//expandImage
@IBAction func expand(_ sender: UITapGestureRecognizer) {
let imageView = sender.view as! UIImageView
let newImageView = UIImageView(image: imageView.image)
newImageView.frame = self.view.frame
newImageView.backgroundColor = .black
newImageView.contentMode = .scaleAspectFit
newImageView.isUserInteractionEnabled = true
let tap = UITapGestureRecognizer(target: self, action: #selector(dismissFullscreen))
newImageView.addGestureRecognizer(tap)
self.view.addSubview(newImageView)
}
func dismissFullscreen(_ sender: UITapGestureRecognizer) {
sender.view?.removeFromSuperview()
}