How do I do if I want to programatically generate a set of buttons and then associate those with IBActions? It’s easy if I add the buttons in Interface Builder, but that I cannot do for this case.
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.
The buttons have the method
- (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents.The code to use this would look like this:
This assumes that your IBAction is named
myActionand thatsomethingis the controller for which that action is defined.