UITableViewCell doesn't get deselected when swiping back quickly

后端 未结 16 1364
甜味超标
甜味超标 2021-01-29 23:49

I\'ve now updated three of my apps to iOS 7, but in all three, despite them not sharing any code, I have the problem where if the user swipes to go back in the navigation contro

16条回答
  •  不思量自难忘°
    2021-01-30 00:55

    You can try to set

    self.clearsSelectionOnViewWillAppear = YES;
    

    in a UITableViewController or

    [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:NO];
    

    in viewWillAppear, maybe before calling [super viewWillAppear:animated]; If your UItableView is not inside an UITableViewController you must deselect the cells manually:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
    }
    

提交回复
热议问题