Remove table accessories indicator from row

Is there a way to turn off auxiliary indicators individually by row? I have a table that uses

- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath { return UITableViewCellAccessoryDetailDisclosureButton; } 

I need to disable it (remove the icon and not trigger the details disclosure event) for one line. I thought this would do it, but it has no result. The indicator still appears, and it still receives the event by touch.

 cell.accessoryType = UITableViewCellAccessoryNone; 
+4
source share
2 answers

This call to the "accessoryTypeForRow .." function is canceled now (from sdk 3.0 +).

The preferred way to set the type of accessory in the cellForRowAt .. method

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"SomeCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } // customize the cell cell.textLabel.text = @"Booyah"; // sample condition : disable accessory for first row only... if (indexPath.row == 0) cell.accessoryType = UITableViewCellAccessoryNone; return cell; } 
+14
source

You can set it from the storyboard. You just need to set the Separator to No.

enter image description here

0
source

Source: https://habr.com/ru/post/1312226/


All Articles