Re: problem with NSAffineTransform...
Re: problem with NSAffineTransform...
- Subject: Re: problem with NSAffineTransform...
- From: Ondra Cada <email@hidden>
- Date: Fri, 21 Sep 2001 10:20:59 +0200
Michael,
>
>>>>> Michael B. Johnson (MBJ) wrote at Fri, 21 Sep 2001 00:27:06 -0700:
MBJ> unfortunately, if
MBJ> I initialize my NSAffineTransform with:
MBJ>
MBJ> _zoomTransform = [NSAffineTransform transform];
MBJ>
MBJ> as opposed to:
MBJ>
MBJ> _zoomTransform = [[NSAffineTransform alloc]
MBJ> initWithTransform:[NSAffineTransform transform]];
MBJ>
MBJ> then it draws correctly the first time, but then the NSAffineTransform
MBJ> pointed to by _zoomTransform gets replaced with an NSString*.
That's quite right -- any class method which creates objects returns them
_autoreleased_ (therefore the object is actually released at the end of event
loop, and the place in memory can be occupied by any other object).
See the retain/release/autorelease methods for more information.
MBJ> I'll admit to not being completely
MBJ> sure what to make of instances that I get back from the class object...
Either you need them temporarily (simple, not 100% perfect, clue: they are
stored in local variables), then nothing. Or you need them for longer time
(simple clue: they are stored in object property or a global variable), then
you have to retain them.
See also the online examples, there's plenty of that there.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc