I suspect you are just assigning your ivar without retaining the
colour. It gets autoreleased and so crashes when you access it later
(stale reference).
blueColor probably continues to work because (as an internal
optimisation) it just so happens that that is a singleton and isn't
autorel
Are you retaining that NSColor object to make sure it sticks around?
- Greg
On Jul 25, 2008, at 5:40 PM, Ashley Perrien wrote:
I have a custom NSView that contains as an instance variable a
color. If I set the color in init as lineColor = [NSColor
blueColor]; all is well. If instead I use [
I have a custom NSView that contains as an instance variable a color.
If I set the color in init as lineColor = [NSColor blueColor]; all is
well. If instead I use [NSColor colorWithCalibratedRed: 0.5 green: 0.5
blue: 1.0 alpha: 1.0], the program crashes if I try and access or
change the col