阅读背景:

如何在swift中正确传递选择器作为参数

来源:互联网 

Conclusively speaking

最后说

I have class A that contains a instances of B. And in class A, I pass a function of A as selector to A method of B. And B use this selector to register notification. However, when the notification comes in, it could not run the selector and show "unrecognized selector sent to instance". If I move all what I want to do in class B into class A, it worked. However, I want them separated so that it seems more organized. I am fairly new to Objective-C and Swift, therefore, I don't know how to pass selector as parameter in this case. Answer in Swift would be great.I have class A th




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: