Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a uitableviewcell unselectable

I am putting together a search string based off 4 tableviewcells, each cell opens a subview and loads a bunch of data the user selects to set the cell of the previous view.

There is an order in which these cells needs to be set so that each preceding list of data in the subview is related to the data set in the parent view.

i.e. in the first cell you select a type of car, in the next cell you look at the models related to the type of car chosen.

That aside The basis of my question is how do I make a cell unselectable until the previous cell/s have been set.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//...
if (indexPath.section == 0) 
    {

if (indexPath.row == 0) // <<--- what could I put in here.... 
        {
//...
}

} }

like image 267
C.Johns Avatar asked Oct 17 '11 20:10

C.Johns


People also ask

How do you make a tableView cell Unselectable?

To completely prevent selection of the UITableViewCell , have your UITableViewDelegate implement tableView:willSelectRowAtIndexPath: . From that method you can return nil if you do not want the row to be selected. This prevents the row from being selected and tableView:didSelectRowAtIndexPath: from being called.

What is Uitableview in Swift?

A view that presents data using rows in a single column. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.1+ tvOS 9.0+


1 Answers

Swift Syntax

cell.selectionStyle = UITableViewCellSelectionStyle.None
like image 115
Dustin Williams Avatar answered Sep 23 '22 07:09

Dustin Williams