Just out of interest does ARC handle this or do you have to release the transform ?
UISlider *slider = [[UISlider alloc] init];
CGAffineTransform transform = CGAffineTransformMakeRotation (DEGREES_TO_RADIANS(90));
slider.transform = transform;
Thanks
Nothing to conform to exactly.
ARC is about Objective-C reference counting (memory management for objects). Core Foundation APIs are C. CGAffineTransform
is a C struct
. C structs are not reference counted, they cannot be sent object messages such as retain and release (it would not compile).
This means very simply that a CGAffineTransform struct must be manually freed somewhere.
One nice thing is, you can create it and use it in a method or function only so its lifetime is scoped to that.
Otherwise, you should use it as a property or ivar, so it will be handled with the wiping of your object instance.
Either way, as long as it is used in one of those ways, you should be ok without any fancy worries (unless you're creating a LOT of these) As you can see below, it's not very big...
struct CGAffineTransform {
CGFloat a;
CGFloat b;
CGFloat c;
CGFloat d;
CGFloat tx;
CGFloat ty;
};
typedef struct CGAffineTransform CGAffineTransform;
In straight C, or if you have some heavy use of these, you would start wanting to do malloc() (or one of it's cousins) and free()