I am adding four to five views to the UIScrollview.
i am creating that views dynamically at run time.
all that views contain one button.
{
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self action:@selector(category_selected:) forControlEvents:UIControlEventTouchUpInside];
}
views are successfully added, but when i am clicking button “unrecognized selector sent to instance 0x657e850” is shown. What am I doing wrong?
You need to implement the
category_selected:method in your controller. The signature should look like this:When you set up the button like this:
I am assuming that you are calling this from your controller, so
selfis the controller, and that is the class that must have thecategory_selected:implemented.