简体   繁体   中英

my button to scroll images does not work on swift

I wanted to make a small carousel type app with swift but I have a problem with my code

in my viewController.swift

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var imageView: UIImageView!

    @IBAction func changeImage(_ sender: Any) {
        imageView.image = #imageLiteral(resourceName: "d6e6f07c-7412-4889-9e78-182d1b7f815c.jpeg")
    }
}

but when i click on the button to scroll the images, his show me

{Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)} in xcode.

Generally, EXC_BAD_INSTRUCTION means that there was an assertion failure in your code.

I guess that the UIImageView doesn't connected with xib or Storyboard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM