How do I know if UITableViewCell is selected?
I would like to imitate a behavior like the one that is in the apple calendar when selecting a date for an event. You have a TableView with to cells and a datepicker. If the first cell is selected the da开发者_JAVA技巧te of the picker is for start date and the opposite for end date.
So, my question is: how do I Know, when handling the date change in the DatePicker, what cell is being selected in tableview at that moment?
Thanks in advance for your help.
if ( 0 == [[yourTable indexPathForSelectedRow] compare:[yourTable indexPathForCell:yourCell]] ) {
// yourCell is selected
}
or you might be able to tell just by looking at indexPathForSelectedRow.
I think you need to implement
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
and check indexPath.row
精彩评论