Reputation: 43
I am writing a simple program that shows and takes away images and I keep getting the error
fatal error: unexpectedly found nil while unwrapping an Optional value
Here is my code:
@IBAction func BeginButton(sender: AnyObject) {
self.Retry.hidden = false
self.Begin.hidden = true
self.Logo.hidden = true
self.GameOver.hidden = false
self.ScoreBoard.hidden = false
}
@IBAction func RetryButton(sender: AnyObject) {
self.Begin.hidden = false
self.Retry.hidden = true
self.Logo.hidden = false
self.GameOver.hidden = true
self.ScoreBoard.hidden = true
}
Please help me!
Upvotes: 1
Views: 69
Reputation: 859
You need to connect your IBOutlets (self.Retry, self.Begin, ...) with the corresponding views in Interface Builder. Right now, one or more of them are nil
.
Here's a detailed explanation from Apple: https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson3.html
Upvotes: 3