2012-10-18 56 views

回答

2

由於缺乏一個更好的解決方案,我目前做的:

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; 
}