スライドを適用しようとしています。私はスレッド1:致命的なエラー:画像にエフェクトを適用しているときにオプションの値をアンラッピングしている間に予期せずnilが見つかりました
Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value
を取得し、ボタンのいずれかに任意のヘルプをクリックするたびに続い が
@IBAction func fadeIn(_ sender: Any) {
imageView.alpha=0
UIView.animate(withDuration: 1, animations: {
self.imageView.alpha=1
})
}
@IBAction func slideIn(_ sender: Any) {
imageView.center=CGPoint(x:imageView.center.x-500,y:imageView.center.y)
UIView.animate(withDuration: 2) {
self.imageView.center=CGPoint(x:self.imageView.center.x+500,y:self.imageView.center.y)
}
}
@IBAction func grow(_ sender: Any) {
imageView.frame=CGRect(x:0,y:0,width:0,height:0)
UIView.animate(withDuration: 1, animations: {
self.imageView.frame=CGRect(x:0,y:0,width:200,height:200)
})
}
私のコードであることをいただければ幸いです。
可能な重複[ "致命的なエラー:予期せずオプションの値アンラップしながら、nilを見つけ、" 何?意味を](https://stackoverflow.com/questions/32170456/what -does-fatal-error-unexpectedly-found-nil-while-unwrap-an-optional-valu) – the4kman
あなたの 'imageView'宣言コードを表示します。それはIBOutletですか? – Krunal