Re: Intermittent scrolling problem in UITableView
Re: Intermittent scrolling problem in UITableView
- Subject: Re: Intermittent scrolling problem in UITableView
- From: Matt Neuburg <email@hidden>
- Date: Sat, 19 Nov 2011 07:31:29 -0800
On Fri, 18 Nov 2011 19:08:44 -0800, Laurent Daudelin <email@hidden> said:
>On Nov 18, 2011, at 18:48, Roland King wrote:
>
>>
>> On Nov 19, 2011, at 10:38 AM, Conrad Shultz wrote:
>>
>>> On 11/18/11 3:29 PM, Laurent Daudelin wrote:
>>>> There isn't much special code in that UITableView subclass and not
>>>> much either in the UITableViewController so I'm a little bit at a
>>>> lost as to what could cause this. There is nothing fancy here, no
>>>> custom handling of touches and things like that, just loading a bunch
>>>> of cells and then loading more when we reach the bottom of the table
>>>> view and there is more data to load.
>>>>
>>>> Anyone has any idea where I could look for this?
>>>
>>> Nothing's jumping out for me (at least I can't recall seeing this behavior).
>>>
>>> How are you adding more data?
>>>
>>> I assume that since you are bothering to load more data only when you
>>> reach the bottom that you are downloading some data for display. I also
>>> assume you are being a good iOS citizen by doing this download on a
>>> background thread/queue. If so, is it possible that you are
>>> accidentally doing some UI work on the background thread? In
>>> particular, might you be calling one of the -reloadData methods? I
>>> could certainly see that causing UITableView to end up in an
>>> inconsistent state...
>>>
>>
>> +1, I was just typing something similar, doing any UI work at all on a background thread often leads to very odd behavior and I note in your second mail that you say when you touch another UI element it all redraws nicely, that is another symptom I've seen before after doing UI work on the background thread.
>>
>> If you are, I would highly recommend blocks to throw the work back to the main thread again, block programming and dispatch queues are possibly one of the nicest things Apple has added in the last few years, they just make stuff like this SO easy.
>
>Thanks for the pointer, I'll check how the stuff is loaded and see if anything UI-related could be executed in the operation queue we're using to load the data.
And not just in the operation queue itself. You are probably communicating back from the operation to some controller, to let it know when the operation is completed. That communication takes place on a background thread, and everything that it triggers takes place on a background thread. Jumping out to the main thread before touching the UI is up to the controller. m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden