How to wrap a Struct into NSObject

后端 未结 3 686
滥情空心
滥情空心 2020-11-30 22:18

this is supposed to be trivial… I think, but I can\'t find a way how to wrap a Struct variable into an NSObject. Is there a method to do so? If not, how would I

3条回答
  •  醉酒成梦
    2020-11-30 23:07

    Use + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform;

    From the docs: "Creates a new value object containing the specified CoreGraphics affine transform structure."

    CGAffineTransform fooAffineTransform = CGAffineTransformMakeScale(.5, .5);
    [NSValue valueWithCGAffineTransform:fooAffineTransform];
    

    +valueWithCGAffineTransform has existed since iOS 2.0.

提交回复
热议问题