Re: nstableview reload with animation possible?
Re: nstableview reload with animation possible?
- Subject: Re: nstableview reload with animation possible?
- From: "Rick C." <email@hidden>
- Date: Wed, 20 Jun 2012 08:02:24 +0800
Thanks again for the replies. Think I was able to get it to work just had to re-code a few things compared to simply using reloadData...
rc
On Jun 20, 2012, at 1:58 AM, Corbin Dunn wrote:
> Well, that method doesn't animate.
>
> Conceptually, what you have to do is this (and assuming you are using a view based table view):
>
> 1. Call beginUpdates on the table *important*
> 2. Modify the table to add/remove all the rows that you added or removed. Note that it works like an NSArray, so calling removeRow:3 will remove row 3, and then what was at row 4 is now at row 3. So to delete what was at row 4 you call removeRow:3 again. This is *different* from how it works on iOS which "freezes" the table and does not treat it like an array
> 3. Call endUpdates
>
> The table will not call the datasource during the time you call beginUpdates/endUpdates.
>
> corbin
>
> On Jun 18, 2012, at 5:26 PM, Rick C. <email@hidden> wrote:
>
>> Thanks I will take a look!
>>
>>
>> On Jun 19, 2012, at 3:59 AM, Marc Respass wrote:
>>
>>>> What I'm basically trying to do is call reloadData but with animation and I can't see how to do it? I know about removing/inserting rows with animation and I tried this, but I keep crashing and I would think it's because I'm removing rows and inserting rows after my datasource has been modified. That's why normally I use reloadData and it works fine. Also, it seems there is a method to do this in iOS but it's not available on Mac. So is it possible to do this? Or can I only use the animation when removing inserting rows without changing the modifying the datasource? Thanks,
>>>>
>>> Hi Rick,
>>>
>>> You probably want
>>> - (void)reloadDataForRowIndexes:(NSIndexSet *)rowIndexes columnIndexes:(NSIndexSet *)columnIndexes NS_AVAILABLE_MAC(10_6);
>>>
>>> In my app, I use it to update rows which get updated one at a time but you can provide an index set with many rows. You might be able to use -rowsInRect which I haven't used passing the rect of the table view's scroll view, I would think. Then you can create the index set with -indexSetWithIndexesInRange:
>>>
>>> Hope this helps
>>> Marc
>>>
>>> _______________________________________________
>>>
>>> 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
>>
>>
>> _______________________________________________
>>
>> 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
>
_______________________________________________
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