Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Good news! I was able to fix/workaround your problem in two different ways (see below).</p> <p>I would say this is certainly an OS bug. What you are doing causes the cell you have moved (using <code>moveRowAtIndexPath:</code>) to be placed above (in front of) the header cell in the z-order.</p> <p>I was able to repro the problem in OS 5 and 6, with cells that did and didn't have UITextFields, and with the tableView in and out of edit mode (in your video it is in edit mode, I noticed). It also happens even if you are using standard section headers.</p> <p><strong>Paul</strong>, you say in one of your comments:</p> <blockquote> <p>I solved it badly using a loader and "locking" the table while preforming a reloadData</p> </blockquote> <p>I am not sure what you mean by "using a loader and locking the table", but I did determine that calling <code>reloadData</code> after <code>moveRowAtIndexPath:</code> does fix the problem. Is that not something you want to do?</p> <pre><code>[self.tableView moveRowAtIndexPath:indexPath toIndexPath:newPath]; //[self.tableView reloadData]; // per reply by Umka, below, reloadSections works and is lighter than reloadData: [self reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; </code></pre> <p>If you dont want to do that, here is another solution that feels a little hacky to me, but seems to work well (iOS 5+):</p> <pre><code>__weak UITableViewCell* blockCell = cell; // so we can refer to cell in the block below without a retain loop warning. ... cell.onTextEntered = ^(NSString* sText) { // move item in my model NSIndexPath *newPath = [NSIndexPath indexPathForRow:0 inSection:indexPath.section]; [self.itemNames removeObjectAtIndex:indexPath.row]; [self.itemNames insertObject:sText atIndex:0]; // Then you can move cell to back [self.tableView moveRowAtIndexPath:indexPath toIndexPath:newPath]; [self.tableView sendSubviewToBack:blockCell]; // a little hacky // OR per @Lombax, move header to front UIView *sectionView = [self.tableView headerViewForSection:indexPath.section]; [self.tableView bringSubviewToFront:sectionView]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload