Working with One Xib with Multiple Classes

冷暖自知 提交于 2019-12-02 10:48:44

Yes it is possible using polymorphism. This is the idea that multiple classes can be sent the same message, (and potentially behave in different ways). You can create a class like: BaseViewController that would have the definition for btnPupl:(id)sender in the @interface. This way any view controller that inherits from BaseViewController will inherit btnPupl:(id)sender.

Another option (I'd go with the first one) is to subclass UIButton and implement the behaviour you want in that subclass.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!