Массив радужных цветов iOS

Я настраиваю массив, который имеет переход между цветами радуги . Прямо сейчас я только что вручную ввел цвета в массив, но их слишком много, чтобы печатать вручную... на данный момент я просто перехожу от 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];
10
задан Albert Renshaw 11 March 2012 в 05:40
поделиться