• 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: minor ARC casting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: minor ARC casting question


  • Subject: Re: minor ARC casting question
  • From: Greg Parker <email@hidden>
  • Date: Tue, 1 Nov 2011 17:21:22 -0700

On Nov 1, 2011, at 5:06 PM, Matt Neuburg wrote:
>    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
>    gradientLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor darkGrayColor] CGColor],
>                            (id)[[UIColor lightGrayColor] CGColor], nil];
>
> And now we're back to my original question. Is that the right way?

Yes.


> And why am I able to get away without saying __bridge id (or whatever), as I would have to do if I were generating my own CGColor and not returning the CGColor via a built-in method?

Because the compiler has a special case wherein you can use an ordinary cast on the result of an Objective-C method that returns a CF type.


--
Greg Parker     email@hidden     Runtime Wrangler


_______________________________________________

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

References: 
 >Re: minor ARC casting question (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: minor ARC casting question
  • Next by Date: Re: NSAssert no longer displaying reason in console
  • Previous by thread: Re: minor ARC casting question
  • Next by thread: Re: minor ARC casting question
  • Index(es):
    • Date
    • Thread