我的myImageView出现错误“线程1:致命错误:意外地发现nil,同时隐式展开了Optional值”。我该如何解决?
@IBOutlet weak var myImageView: UIImageView!
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let tapGesture = UITapGestureRecognizer()
tapGesture.addTarget(self, action: #selector(ViewController.openGallery(tapGesture:)))
//errors are happening on these lines
myImageView.isUserInteractionEnabled = true
myImageView.addGestureRecognizer(tapGesture)
线程1:致命错误:在隐式展开一个可选值时意外发现nil