I have a bunch of programmatically created NSButtons in my app. How can I go about setting the subclass of these NSButtons without using Interface Builder?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you create the button, don’t create them as NSButtons, create them as your subclass. For example, if you had a subclass of
NSButtoncalledMyButton, instead of something like:You would have something like:
This way
buttonwill be an instance ofMyButton.