When I run my iOS app on Apple Silicon Mac (ARM) in “Designed for iPad” mode, I’m not able to use a UISlider
contained in a reorderable tableview cell. Dragging the slider triggers a reorder of the cell rather than sliding the slider.
This behaves correctly on iOS devices: when I drag the slider, no reorder is triggered.
I tried a Swift version which yields the same result.
Here’s how the UITableView
is setup:
[self.tableView setEditing:YES animated:YES];
[self.tableView setAllowsSelectionDuringEditing:YES];
Here’s the cellForRowAtIndexPath
implementation:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:@"AddRow"];
if (cell == nil)
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"AddRow"] autorelease];
UISlider *slider = [[UISlider new] autorelease];
[cell.contentView addSubview:slider];
return cell;
}
<code>[self.tableView setEditing:YES animated:YES];</code><code>[self.tableView setEditing:YES animated:YES]; </code>[self.tableView setEditing:YES animated:YES];
Well, there’s your problem. Being able to edit, meaning that the user can rearrange or delete cells, is incompatible with the notion of being able to do things in the cell. Just the opposite: the slider should be disabled when the cell/table is in edit mode.
1