• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UITableView updating problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UITableView updating problem


  • Subject: Re: UITableView updating problem
  • From: glenn andreas <email@hidden>
  • Date: Thu, 13 Aug 2009 08:31:01 -0500


On Aug 12, 2009, at 9:15 PM, DKJ wrote:

I've got a UITableView where the colour of the row text can change depending on its place in the table. For example, a row may change colour if it's moved from the bottom to the top of the table; and sometimes its colour may change if another row is deleted or inserted.

The problem is that the text colour is not updated until the table reloads its data. So (e.g.) if I move a row from the bottom to the top, its colour doesn't change immediately.

I'd like the text colours to be updated when the table leaves edit mode. But according to the docs, I can't call reloadData in the tableview controller's commitEditingStyle or moveRowAtIndexPath methods. (I tried doing it anyway, and got into trouble.)

Is there any way I can get the table to update as soon as the user presses the Done button? Or even better, as soon as the row deletion or move is completed?


You're using a sledge hammer (reloadData) when you need a small screwdriver.


When you are told of the row moving, you can access the cell used to draw that row (cellForIndexPath:) and then just adjust the color accordingly. If you need to adjust other cells in that section, you can just loop through them, calling cellForIndexPath: for each one you want to adjust - if it is offscreen, it will return nil, so you can skip it.

This is also a good way to handle things like having a check mark selection... (change the accessoryType of the selected row, go through and remove the check mark from the previous one).


Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art



_______________________________________________

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


  • Follow-Ups:
    • Re: UITableView updating problem
      • From: Brian Slick <email@hidden>
References: 
 >UITableView updating problem (From: DKJ <email@hidden>)

  • Prev by Date: NSArrayController - compound values vs Select Inserted Objects
  • Next by Date: Re: UITableView updating problem
  • Previous by thread: UITableView updating problem
  • Next by thread: Re: UITableView updating problem
  • Index(es):
    • Date
    • Thread