I have a UIView for which I would like to set its borderColor:
UIView *myView = ...;
myView.layer.borderWidth = 1;
myView.layer.borderColor = [UIColor greenColor].CGColor;
Is it safe to do it like this?
The UIColor object will be autoreleased and with it the CGColor object. Now, does the borderColor property retain the CGColor so that it is safe to let the UIColor be autoreleased, or do I have to retain the UIColor in a separate instance variable?
The
CGColoris not an object in the same sense asUIColor, but the layer would retain it usingCGColorRetain()so this is fine