How would I store a CGAffineTransform in NSUserDefaults? Since it contains 6 float values it takes a lot of repetitive work to store each value as float... so I'm wondering if there is a smarter way.
Use NSStringFromCGAffineTransform() and CGAffineTransformFromString().
Using NSValue, I got:
-[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value 'CGAffineTransform: {{0.9291659, 0, 0, -0.9291659}, {41.675232, 823.75122}}' of class 'NSConcreteValue'. Note that dictionaries and arrays in property lists must also contain only property values.
Wrap it in an NSValue
instance:
NSValue *affineTransformValue = [NSValue valueWithCGAffineTransform:myTransform];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With