开发者

Saving Transforms into NSUserDefaults?

开发者 https://www.devze.com 2023-03-17 02:03 出处:网络
I am making a game, and want to save the states of the game scene. I know we can save CGPoints into NSUSerDefaults, but is there any way to

I am making a game, and want to save the states of the game scene. I know we can save CGPoints into NSUSerDefaults, but is there any way to save "Transform" into it?

If not, is there any function to "开发者_开发知识库read" a transform (for eg, the scale/angle of a view)?

Thanks in advance for your help.


Simple, wrap it in an NSValue:

CGAffineTransform t;

[userDefaults setObject:[NSValue valueWithCGAffineTransform:t] forKey:@"Transform"];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号