How would I go about sending a reloadData message to the tableView from a custom tableViewCell?
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 easiest way to implement that is to use Delegates.
Define a protocol in your CustomTableCell.h like this:
The next step is to provide a delegate var:
Make shure you synthesize your delegate-Variable in the CustomTableCell.m.
Now you have a Delegate Defined. There are three remaining steps:
When you create your cell you have to set the delegate for this cell like
Make shure your TableViewController implements your CustomTableCellDelegate. If you do this you will be forced to implement the – (void)reloadMyTable in your TableViewController:
The last step is to call this method from your CustomTableCell like this:
More about Delegation here.
In short: You define a protocol in your CustomTableViewCell, which is implemented by the TableViewController. If you send a method-message to your delegate, this message will be send to your TableViewController.