vallllll
vallllll

Reputation: 2761

iphone objective C colors

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

Upvotes: 4

Views: 5829

Answers (2)

rckoenes
rckoenes

Reputation: 69469

Apple has chosen to use gray over grey:

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

Upvotes: 1

Legolas
Legolas

Reputation: 12325

Use GRAY !

cell.backgroundColor = [UIColor grayColor];

Upvotes: 8

Related Questions