i have a my requirement disable the table cell.i have controls on that cell like(textFeild,imageview,button).when i access one control it prefprms another action so plz help me . thanks in advance.
If you want to disable selection for just some of the cells, use: cell. userInteractionEnabled = NO; As well as preventing selection, this also stops tableView:didSelectRowAtIndexPath: being called for the cells that have it set.
So, to remove a cell from a table view you first remove it from your data source, then you call deleteRows(at:) on your table view, providing it with an array of index paths that should be zapped. You can create index paths yourself, you just need a section and row number.
deselectRow(at:animated:) Deselects a row that an index path identifies, with an option to animate the deselection.
It is not clear what you want exactly. If you just want to disable the cell i think you mean this
cell.userInteractionEnabled = NO;
But what do you mean by when i access one control it performs another action ?
I would suggest using custom UITableViewCells. Put all your controls on custom cells, that way all the events pertaining to that controls would be called in the actions in your custom cell class. In the tableView class you just don't have to give any implementation for didSelectRowAtIndexPath. That way your controls on the cells would be clickable.
It could also apply a color effect:
UIView *lab = [[UIView alloc] initWithFrame:cell.frame];
[lab setBackgroundColor:[UIColor lightGrayColor]];
cell.backgroundView = lab;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With