• 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: CGImageRef as a property of a cocoa object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGImageRef as a property of a cocoa object


  • Subject: Re: CGImageRef as a property of a cocoa object
  • From: Dave <email@hidden>
  • Date: Sat, 21 Sep 2013 16:13:42 +0100

On 15 Sep 2013, at 12:24, Roland King <email@hidden> wrote:
>
> The clang document which bbum links to says it has to be a typedef. So that gives you two good reasons, one that the documentation mandates a typedef and the other that Bill Bumgarner weighed in. So I'd say, if you want to try this, you have to use a typedef.
>
> The clang document also really recommends against using the typedef. Whereas the pointer will be treated correctly by ARC, it suggests other operations on it might not work, gives two examples, the inference I drew reading it was 'these two or other things we haven't really thought about'.
>
> I don't know as there is a recommended way to do what you like. In the past when I have a CoreFoundation object I want as a property, I don't specify anything in the property definition apart from readwrite and I write my own getter and setter to CFRetain()/CFRelease() it (and remember to do something appropriate to release it in dealloc). Always worked fine for me at the expense of a few lines of code.
>

Yes, that's what I do too, except use a property, then you just set it to nil.

Also CF objects will throw an exception if you call release with a nil pointer, so you can check for this in your setter.

All the Best
Dave




_______________________________________________

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: CGImageRef as a property of a cocoa object
      • From: Graham Cox <email@hidden>
References: 
 >CGImageRef as a property of a cocoa object (From: Kevin Meaney <email@hidden>)
 >Re: CGImageRef as a property of a cocoa object (From: Roland King <email@hidden>)

  • Prev by Date: iAd banner on iOS 7 simulator
  • Next by Date: Strange behaviour of iPhone
  • Previous by thread: Re: CGImageRef as a property of a cocoa object
  • Next by thread: Re: CGImageRef as a property of a cocoa object
  • Index(es):
    • Date
    • Thread