Re: Adding cells from the bottom (like a stack) in UITableView
Re: Adding cells from the bottom (like a stack) in UITableView
- Subject: Re: Adding cells from the bottom (like a stack) in UITableView
- From: Fritz Anderson <email@hidden>
- Date: Wed, 25 Apr 2012 10:41:48 -0500
On 21 Apr 2012, at 4:53 PM, The Rhythmic wrote:
> Hi, Am a newbie to iOS programming. This is what am trying to do:
>
> 1. The user enters some text in the screen and it keeps getting added to a
> UITableView.
>
> 2. As usual, it's getting added *from* the top.
>
> 3. But I want to add it from the bottom i.e. each new message that's added
> is added *above *the rest/existing ones, and not below.
>
> Can someone offer some pointer on this please!
Table views don't care how you order the data in them. They don't keep data, they just ask you how to format the next cell that comes into view.
So have your data source keep track of the order in which new data comes into the list, send -insertRowsAtIndexPaths:withRowAnimation: to the table view, and let it pull the contents from your data source. When it asks, tell it the information from your latest datum goes into index path {0, 0}.
— F
_______________________________________________
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