I placed 6 UIButton on nib, I don’t want to create 6 variables for each of button, is there any way to access buttons by their Tag or something else?
I found a method viewWithTag, but seems it is used for NSView.
THX~
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.
If you created them by Interface Builder, you must go to IB and assign a unique tag to each button (1, 2, …) and inside your code you can refer to them by
UIButton *button1 = (UIButton *)[self.view viewWithTag:1],UIButton *button2 = (UIButton *)[self.view viewWithTag:2]and so on.