Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable the table cell in my tableview?

Tags:

iphone

ios4

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.

like image 292
simbesi.com Avatar asked May 26 '11 06:05

simbesi.com


People also ask

How do I turn off cell selection?

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.

How do you remove cells from a table view?

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.

How do you deselect a row in Swift?

deselectRow(at:animated:) Deselects a row that an index path identifies, with an option to animate the deselection.


3 Answers

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 ?

like image 52
visakh7 Avatar answered Oct 13 '22 00:10

visakh7


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.

like image 33
Vin Avatar answered Oct 12 '22 23:10

Vin


It could also apply a color effect:

    UIView *lab = [[UIView alloc] initWithFrame:cell.frame];
    [lab setBackgroundColor:[UIColor lightGrayColor]];
    cell.backgroundView = lab;
like image 21
Franji Avatar answered Oct 13 '22 01:10

Franji