绘制此渐变有什么问题?

时间:2013-04-13 03:06:06

标签: objective-c memory-management quartz-core

当我尝试绘制渐变时,我得到了一个EXEC BAD ACCESS。有人可以解释我错过了什么(显然这里的桥接有问题):

CGColorRef darkOrangeColor = [[UIColor colorWithRed:232.0f/255.0f
                                              green:72.0f/255.0f
                                               blue:22.0f/255.0f
                                              alpha:1.0] CGColor];

CGColorRef lightOrangeColor = [[UIColor colorWithRed:245.0f/255.0f
                                               green:196.0f/255.0f
                                                blue:104.0f/255.0f
                                               alpha:1.0] CGColor];

//下两行是我们崩溃的地方......

NSArray *colors = [NSArray arrayWithObjects:(__bridge id)darkOrangeColor, (__bridge id)lightOrangeColor, nil];


CGGradientRef gradient = CGGradientCreateWithColors(colorSpace,
                                                    (__bridge CFArrayRef) colors, locations);

0 个答案:

没有答案