Reputation: 137
In UITable i get index of selected row. And when i get index of row i want disable her that then it can not be pressed but highlight should remain. And when i click another row it is highlight and previous row is enable and highlight is disable.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CellIndex = indexPath.row;
[self.containerViewController swapViewControllers:CellIndex];
}
I want nothing happens if you click on the row that is already pressed. Thanks everyone for help.
Upvotes: 0
Views: 55
Reputation: 6396
Keep a variable that knows which was the last row pressed, and check in tableView:didSelectRowAtIndexPath:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(previouslySelectedIndexPath == indexPath)
return;
previouslySelectedIndexPath = indexPath;
CellIndex = indexPath.row;
[self.containerViewController swapViewControllers:CellIndex];
}
Upvotes: 2