• 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: problem with NSAffineTransform...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: problem with NSAffineTransform...
      • From: Rob Rix <email@hidden>
References: 
 >problem with NSAffineTransform... (From: "Michael B. Johnson" <email@hidden>)

  • Prev by Date: problem with NSAffineTransform...
  • Next by Date: Re: problem with NSAffineTransform...
  • Previous by thread: problem with NSAffineTransform...
  • Next by thread: Re: problem with NSAffineTransform...
  • Index(es):
    • Date
    • Thread