Is it possible or not to set button’s target to be another thing than “self”?
Such as UIView or UIWindow??
I tried but I got EXC_BAD_ACCESS as error.
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.
You can set the target to any
instance/object. The instance/object should respond to the selector you set. Otherwise you will get the SIGABRT exception.Mostly we set the target to our custom view controllers, because we do some operations on some events. We set
Selfas target if we defined the action in the current view controller. You can set it some other view controller like the following,When you click on the
yourButtonthe actiononButtonPressed:of the view controller instanceawill be triggered. Note: AViewController should implement the methodonButtonPressed:. You will receive SIGABRT, if not.