【发布时间】:2012-03-11 05:40:34
【问题描述】:
我正在设置一个数组,该数组在彩虹的颜色中具有过渡。现在我刚刚手动输入了数组中的颜色,但是手动输入的颜色太多了......到目前为止,我只是从 0.25 到 0.5 到 0.75 到 1 等等,直到我从红色到绿色再到蓝色然后回来。 (见下面的代码)我怎样才能让数组自动生成不仅仅是 0.25 --> 0.5 --> 0.75 但可能是 0.05 --> 0.10 --> 0.15 --> 0.20 等等的颜色,...这是我的数组:
rainbowColors = [[NSArray alloc] initWithObjects:
[UIColor colorWithRed:1 green:0 blue:0 alpha:1],
[UIColor colorWithRed:1 green:0.25 blue:0 alpha:1],
[UIColor colorWithRed:1 green:0.5 blue:0 alpha:1],
[UIColor colorWithRed:1 green:0.75 blue:0 alpha:1],
[UIColor colorWithRed:1 green:1 blue:0 alpha:1],
[UIColor colorWithRed:0.75 green:1 blue:0 alpha:1],
[UIColor colorWithRed:0.5 green:1 blue:0 alpha:1],
[UIColor colorWithRed:0.25 green:1 blue:0 alpha:1],
[UIColor colorWithRed:0 green:1 blue:0 alpha:1],
[UIColor colorWithRed:0 green:1 blue:0.25 alpha:1],
[UIColor colorWithRed:0 green:1 blue:0.5 alpha:1],
[UIColor colorWithRed:0 green:1 blue:0.75 alpha:1],
[UIColor colorWithRed:0 green:1 blue:1 alpha:1],
[UIColor colorWithRed:0 green:0.75 blue:1 alpha:1],
[UIColor colorWithRed:0 green:0.5 blue:1 alpha:1],
[UIColor colorWithRed:0 green:0.25 blue:1 alpha:1],
[UIColor colorWithRed:0 green:0 blue:1 alpha:1],
[UIColor colorWithRed:0.25 green:0 blue:1 alpha:1],
[UIColor colorWithRed:0.5 green:0 blue:1 alpha:1],
[UIColor colorWithRed:0.75 green:0 blue:1 alpha:1],
[UIColor colorWithRed:1 green:0 blue:1 alpha:1],
[UIColor colorWithRed:1 green:0 blue:0.75 alpha:1],
[UIColor colorWithRed:1 green:0 blue:0.5 alpha:1],
[UIColor colorWithRed:1 green:0 blue:0.25 alpha:1],nil];
【问题讨论】:
标签: objective-c ios arrays rows