我有一个如下设置的UIImageView出口:
@IBOutlet weak var imageView: UIImageView!
然后具有一些逻辑,如果匹配某个值,则该逻辑会更改图像:
if(someValue == "1"){
imageView.image = UIImage(named:"image1")
}else if(someValue == "2"){
imageView.image = UIImage(named:"image2")
}
执行此操作时,出现以下错误:
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value