开发者

How do I know if UITableViewCell is selected?

开发者 https://www.devze.com 2022-12-30 16:57 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消