Such a problem. You need to add protocols (UIPickerViewDelegate, UIPickerViewDataSource) for the Picker View to get it working. At the same time, the Picker View itself is not on the start page, which is why an error is generated when compiling, since the attribute "self" is used (This, as I understood it). Here is the code:
class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { @IBOutlet weak var imageView: UIImageView! @IBOutlet weak var pickerView: UIPickerView! let array = ["One", "Two"] override func viewDidLoad() { // Do any additional setup after loading the view, typically from a nib. super.viewDidLoad() pickerView.delegate = self pickerView.dataSource = self self.imageView.image = UIImage(named: "1club") } ....... Does anyone know how to deal with this?
I really hope for your help!