• 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: Where to release in UIView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where to release in UIView


  • Subject: Re: Where to release in UIView
  • From: Fritz Anderson <email@hidden>
  • Date: Sat, 18 Jul 2009 10:50:32 -0500

On 18 Jul 2009, at 10:16 AM, DKJ wrote:
On 18-Jul-09, at 8:08 , Fritz Anderson wrote:
How did you create the NSDictionary? Do you declare a property or accessor methods for the instance variable? Did you use them? If a property, does it have the copy or retain attributes?
Show your declaration and initialization code.

This is what I have in awakeFromNib

    shadingAreas = [[NSDictionary alloc] initWithObjectsAndKeys:
         SaM, @"SaM", SeM, @"SeM", nil];

Which leads to my next question: The objects in this dictionary are CGMutablePathRefs. How should I wrap these for the dictionary? As NSValues, using valueWithPointer:?

You have to release shadingAreas. You alloc'ed it, you own it.

My understanding is that the opaque CG types are all CFType objects (a skim of CGPath.h confirms this for CGPathRef), and that the managed- object methods work on CFTypes. NSDictionary retains its value objects. Assuming you don't want access to SaM and SeM independent of the dictionary, call CGPathRelease on both of them once the dictionary has them. They'll stick around till you release the dictionary.

	— F

_______________________________________________

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


  • Follow-Ups:
    • Re: Where to release in UIView
      • From: DKJ <email@hidden>
References: 
 >Where to release in UIView (From: DKJ <email@hidden>)
 >Re: Where to release in UIView (From: Fritz Anderson <email@hidden>)
 >Re: Where to release in UIView (From: DKJ <email@hidden>)

  • Prev by Date: Re: NSTextView without NSScrollView
  • Next by Date: Custom NSArrayController - Dynamic Class?
  • Previous by thread: Re: Where to release in UIView
  • Next by thread: Re: Where to release in UIView
  • Index(es):
    • Date
    • Thread