I can't see the characters I want to display

Asked 2 years ago, Updated 2 years ago, 34 views

I'm a beginner.I make a simple omikuji app with swift.

in ViewController.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?

swift

2022-09-30 16:21

2 Answers

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?


2022-09-30 16:21

@IBAction funcuranau (sender:UIButton) {...}

If you're using StoryBoard, it works just by connecting Action here.


2022-09-30 16:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.