• 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: How to adjust refCount?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to adjust refCount?


  • Subject: Re: How to adjust refCount?
  • From: Steve Weller <email@hidden>
  • Date: Mon, 12 Dec 2005 21:19:00 -0800


Reading some more I realize that I don't have to adjust anything. My superclass doesn't shallow copy: it uses alloc/init, so gives me a "clean" object to start with. I do still have to copy across all the parts of the original that I need.

On Dec 11, 2005, at 10:45 PM, mmalcolm crawford wrote:


On Dec 11, 2005, at 10:38 PM, Steve Weller wrote:
I am following (and understanding) the Apple documentation on implementing -copyWithZone and -mutableCopyWIthZone.
My code needs to adjust refCount to 1 since the copy of the object made by the superclass's -copyWithZone was a shallow copy. But how do I do that? There seems to be no instance variable or method I can use called refCount that I can assign 1 to. Do I need to #import anything extra?

alloc creates an object with a retain count of 1. You just have to *not* autorelease the returned object...

mmalc

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

--
Watch me learn Cocoa http://homepage.mac.com/bagelturf/



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >How to adjust refCount? (From: Steve Weller <email@hidden>)
 >Re: How to adjust refCount? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: "Detaching" a managed object.
  • Next by Date: Re: NSObject Exercise comments?
  • Previous by thread: Re: How to adjust refCount?
  • Next by thread: Re: How to adjust refCount?
  • Index(es):
    • Date
    • Thread