How could I go about animating a row in a table view?
I've had a go at it but get stuck at the the first post which is getting the actual cell, here's what I do:
int selectedRow = [tableView selectedRow];
NSTextFieldCell *textFieldCell = [tableView preparedCellAtColumn:1 row:selectedRow];
I then try and set it's background color with [textFieldCell setBackgroundColor:[NSColor redColor]];
, but this doesn't change anything in the table view.
I assume now that the cell returned in preparedCellAtColumn:row:
isn't actually the one in the table view but a completely new one.
So I ask, if I can't even get the cell how can I animate the row (e.g fade out/in)?
As someone who has spent many, many hours trying to fight NSTableView to add animations like those of UITableView, here's three options I recommend, in this specific order:
1) Wait 30 days. Lion is coming and (toeing the NDA line), I think you'll be very happy.
2) Check out some alternative tableViews on [cocoacontrols.com][1] such as JATableView or PXListView. These are pretty good and can serve very well, depending on what your table contains.
3) If you want complete and reliable control over animations for a tableView in 10.6 or lower, you're going to have to roll your own. At the very least, the projects above can give you a great head start. And, since it's likely you only need a small subset of what NSTableView has to offer, the task is not as monumental as it sounds. The worst part about the experience is that you lose the ability to configure everything in IB.
You'll find some Google results for "Animate NSTableView," but in my experience the results were never good enough to ship and you'll exert a LOT of effort fighting NSTableView along the way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With