Grouped UITableView footer sometimes hidden in Quick Scroll

OK, this is a puzzle. There is one similar post , but it doesn't sound like counting enough, so I'm posting it. :)

I have a grouped UITableView with header and footer. The footer includes two kinds of UIButtons , side by side. Nothing serious.

Now ... there is a toggle button in the UIToolbar at the bottom for more / less information in this table view. So I create my delete / insert index paths with fade row animations, all the normal ingredients sandwiched between beginUpdates

and endUpdates

call the UITableView ... and that works great! It also happens that my footer can sometimes be pushed out of the bottom of the display.

Here's where it gets weird. If I drag my finger up the screen while scrolling the view up, I should see this footer in the end, right?

Ok ... most of the time I do. BUT if I point my finger there is no footer for faster scrolling. Even if you try to click in this area, there is no response.

However, if I scroll back again, just to hide that footer (or rather hide the area where the footer would normally be), and then scroll back, there again!

This only happens when inserting rows. If I remove the lines, the footer remains ... unless of course it is already hidden and I have not performed the above spell to get it back.:)

I have been trying to trace this, but to no avail. I suppose tracking through scroll operations is a crazy suggestion! Maybe some creative protocols ... suggestions, anyone? Or is this a known issue in 3.1 where it comes to row insertion / deletion? (I don't remember seeing this before 3.1.)

+2


source to share


2 answers


Have you tried to change something in the footer in the method you call from the footer buttons for example. change text to UILabel in footer? This is what I am trying to do. BUT: The footer is not updated. Or, to be more precise: it is updated, but not on the screen. Scrolling the footer out of the visible array and backward reveals the correct footer. So the problem is updating.

So maybe you are seeing the same redrawing problem?

I tried calling all methods (needslayout needsDisplay etc.), nothing worked. The only way to solve this is to reload the table or partition, but that kills my rowAnimation. Then I tried to trigger a reboot through the notification, hoping that the animation would complete before the notification was called. Nope. In the end, I use a scheduled timer to reload the Date with a 100-200ms delay, started on my I / O line. So the animation is complete before loading.

It looks like it works now, but the price is a short "flash" with the wrong footer before it gets updated.



UPDATE

Ok, with the support of Skie, I solved the redrawing issue. Please contact.

I'm not sure if this approach, or at least the idea, can solve your problem too, but maybe ....

0


source


OK, moving forward with our application, I stumbled upon a redrawing issue more often. After examining hours and hours, it seems that there is only one solution [tableView reloadData]. But there is a better solution (than in my first answer) for broken animation. You can get a method call as soon as the animation is over with this and there will be no more "flash":

[UIView beginAnimations:nil context:[NSNumber numberWithInt:section]];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
...do something on the table..
and commitAnimation

      

In your animationDidStop, reload the table.



But it is still difficult to find the right moment / event to reload, in particular if you are working with fetchedResultsController, which independently triggers its delegate methods as soon as the attribute that is used for sorting changes.

This whole programming exercise around the problem of updating cells, which shouldn't be this way.

0


source







All Articles