Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone objective C colors

Tags:

colors

iphone

I have a table view and I would like the cells to be of alternate colors so I have found this code :

if ((indexPath.row % 2) == 0)
    cell.backgroundColor = [UIColor greyColor];
else
    cell.backgroundColor = [UIColor whiteColor];

it compiles all right but when I run the app I get the following error:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIColor greyColor]: unrecognized selector sent to class 0xfbad60'

well I usually program in android so I thought some colors were defined by default but it seems that's not the case. I am really new to this how could I define some colors something like color black="000000"? Is there a tutorial about this? I have looked around but couldn't find anything.

thks

like image 404
vallllll Avatar asked Jan 17 '23 21:01

vallllll


2 Answers

Use GRAY !

cell.backgroundColor = [UIColor grayColor];
like image 89
Legolas Avatar answered Jan 22 '23 19:01

Legolas


Apple has chosen to use gray over grey:

if ((indexPath.row % 2) == 0)
    cell.backgroundColor = [UIColor grayColor];
else
    cell.backgroundColor = [UIColor whiteColor];
like image 29
rckoenes Avatar answered Jan 22 '23 17:01

rckoenes