“Unrecognized selector sent to instance” in swift

后端 未结 10 495
刺人心
刺人心 2020-12-10 10:36

I have no idea what I am doing wrong. I am also quite new to programming so I am not very good at debugging. This was a test app so that I can see how swift ties in with app

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-10 11:24

    For those who end up in my shoes: If you're creating your button in a static context, ensure you're passing the correct target to UIButton.addTarget(_:action:for:). Passing self will result in passing the type not an instance.

提交回复
热议问题