Re: minor ARC casting question
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