ios - how to assign 3 different colour to rows in an order and reverse that order -
i designing app using table view. here have assign 3 different colours cell of tableview simultaneously... here comes problem after assigning these colours next row have again assign same colours in reverse order. example have 3 colours sequence in need assign these colours : red - green - blue - blue - green - red - red - green - blue - blue - green - red... , on. here lets don't know how many rows there sequence should go on only... please help!!!
declare below array global array :
nsmutablearray *colorarray;
viewdidload
function :
colorarray = [[nsmutablearray alloc] initwithobjects:[uicolor redcolor],[uicolor greencolor],[uicolor bluecolor],[uicolor bluecolor], [uicolor greencolor], [uicolor redcolor], nil];
cellforrowatindexpath
method :
cell.backgroundcolor = [colorarray objectatindex:indexpath.row % 5];
and done :).
Comments
Post a Comment