Reputation: 97
I'm using Async Display Kit to display cell nodes in an ASTableView. How can I set a custom color for the cell node's selected state. With normal tableView cells I would just override
in my cell implementation, but that method doesn't exist on ASCellNodes. Has anyone else encountered this problem and how did you solve it?
Upvotes: 0
Views: 784
Reputation:
Assuming you've subclassed ASCellNode to create your own cells, you could just add your own setHighlighted method.
e.g.
- (void)setHighlighted:(BOOL)highlighted {
if (highlighted) {
self.backgroundColor = [UIColor blueColor];
} else {
self.backgroundColor = [UIColor whiteColor];
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MyNodeSubclass * node = (MyNodeSubclass *)[(ASTableView *)tableView nodeForRowAtIndexPath: indexPath];
[node setHighlighted: YES];
}
Note: You'll need to maintain your own state in regards to which cells are selected/deselected
Upvotes: 1