NSCell subclassing nightmares
NSCell subclassing nightmares
- Subject: NSCell subclassing nightmares
- From: Chase Meadors <email@hidden>
- Date: Sun, 28 Jun 2009 22:10:39 -0500
I never dreamed such a task could cause such difficulty!
I'm making a custom cell that will 'animate' in a sense. Each of these
cells holds an NSTimer. The object value sets a bool that determines
whether the code inside the timer's method is executed or not. The
code in this method simply increments a value and requests the table
view to redraw. So the object value effectively starts and stops the
animation.
Well, in the montage of problems that arose from this, I found out
more about how cells work, but I'm still confused. It took me forever
to discover that the weird problems with bindings I was experiencing
stemmed from the fact that there is ONE cell for a table column, that
it uses to draw all its data.
Through google, I read about implementing -copyWithZone:, but
breakpoints in this method never get called...
I tried overriding table column's -dataCellForRow: and returning a new
cell [[MyCell alloc] init]. This, however, apparently causes infinite
cells to be allocated, and a crash happens.
In short, a value change that should affect one cell affects all of
them. Some magic is happening in Apple's cell classes that makes
values affect only the intended cell. Sorry if I'm missing something
obvious here... but I'm completely stumped.
_______________________________________________
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