I confused about my custom cell. I am creating custom cell including the 2 labels and one button. Now how can I set the button click event as I am using this cell in another file ?
any suggestion ?
Thanks..
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 one create the button, one need to set the action for that (The function,which respond to the user interaction),
So this action will always receive the touch event for UIButton regardless where your are adding your
UIButtonas subview , means you can add your button as subview in any class which is inherited fromUIViewEDITED:
you can either define the action ifor your
UIButtonin CustomCell OR in yourTableView 'sclass, But the decision could be taken based on the action of yourUIButton, if the button change the state of yourCustomCellthen add it in yourCustomCelland if the button do some external operation (like sending request to server) then add it in the same class where you create the CustomCell.