我怎样才能CGAffineTransform
从NSString
Cocoa 中获得一个?
在 iOS 上有CGAffineTransformFromString
.
我怎样才能CGAffineTransform
从NSString
Cocoa 中获得一个?
在 iOS 上有CGAffineTransformFromString
.
由于缺乏更好的解决方案,我目前正在这样做:
CGAffineTransform CGAffineTransformFromString(NSString *string)
{
string = [string stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"[ ]"]];
NSArray *components = [string componentsSeparatedByString:@","];
CGAffineTransform transform;
transform.a = [[components objectAtIndex:0] floatValue];
transform.b = [[components objectAtIndex:1] floatValue];
transform.c = [[components objectAtIndex:2] floatValue];
transform.d = [[components objectAtIndex:3] floatValue];
transform.tx = [[components objectAtIndex:4] floatValue];
transform.ty = [[components objectAtIndex:5] floatValue];
return transform;
}