Setting editingStyle on custom cell in tableFooterView
The following code (located in my -viewWillAppear
) successfully implements a cell as a tableFooterView:
CGRect cellRect = [self.tableView rectForRowAtIndexPath:0];
UITableViewCell *footerCell = [[UITableViewCell alloc] initWithFrame:cellRect];
//footerCell.editingStyle = UITableViewCellEditingStyleInsert;
footerCell.textLabel.text = @"Add New Class";
self.tableView.tableFooterView = footerCell;
However, the line that is commented out returns this error: object cann开发者_JS百科ot be set - either readonly property or no setter found
How can I set the editingStyle of this cell to insert?
Normally UITableViewCell
instances are meant to only go into UITableView
"rows" and not into the footer itself. However since it is subclass of UIView
I guess it will work.
The issue you are having is that it is a readonly property. The information you are trying to set is normally discovered by the UITableView
through delegates. Therefore you are trying to put a square peg into a round hole.
I would create a custom UIView
to put into your footer instead of trying to put a UITableViewCell
in there.
精彩评论