Home>

HereIt looks like a continuation of
Is it possible to save the image data 1.png in the photo app, enter characters, and change the screen when the entered characters and the data name of the image data are the same?

Save it like a photo app 1.png 2.png.

Open the app and enter characters. Press the "1.png" button (only this button)

When data exists, the screen transitions to screen 1.
If the data does not exist, a message such as "Data does not exist" is displayed.

  • Answer # 1

    Why don't you write it like this?

    @IBOutlet weak var sampleTextField: UITextFiled!
    var imageNameStr: String = "sampleImege"
    @IBAction func btnDidTap (_ sender: UIButton) {
        if imageNameStr! = ""&&sampleTextField.text! == imageNameStr {
            // Transition ~
        } else {
            // The name is different ~
        }
    }


    Just compare the strings

    As for the name of the image, why not prepare a name or pick up the name and respond according to your request?