I'm a beginner.I make a simple omikuji app with swift.
import UIKit
classViewController:UIViewController {
@IBOutlet varuranau: UIButton!
@ IBAction func Uranau (sender: UIButton) {
}
@ IBAction funcuranau (sender: UIButton) {
varkekka=""
varkazu=arc4 random_uniform(5)
switch kazu {
case4:
kekka = "Okichi"
case3:
kekka="Nakayoshi"
case2:
kekka = "Kokichi"
case1:
kekka = "Good luck"
case0:
kekka = "Bad"
default:
kekka = "Error"
}
print(kekka)
}
"When I wrote ""Okichi,"" Nakayoshi, and Kokichi were not originally mentioned."
What's wrong with you?
It seems that there are two functions with the same name in the first uppercase letter, but are there any capital letters connected to the UI?
If you don't need uppercase letters, why don't you comment out?
@IBAction funcuranau (sender:UIButton) {...}
If you're using StoryBoard, it works just by connecting Action here.
© 2024 OneMinuteCode. All rights reserved.