A: 

I.m.h.o the UIcolor method is more readable. I think macro's are great if they solve a problem; i.e. provide more performance and/or readable code.

It is not clear to me what the advantage of using a macro is in this case, so I'd prefer the second option.

Adriaan
but how do i pass this web safe colour value 33CC00 in colorwithrgb method
Rahul Vyas
+3  A: 
Tim
+1  A: 

I typically recommend functions rather than complex #defines. If inlining has a real benefit, the compiler will generally do it for you. #defines make debugging difficult, particularly when they're complex (and this one is).

But there's nothing wrong with using a function here. The only nitpick I'd say is that you should be using CGFloat rather than float, but there's nothing wrong with the hex notation if it's more comfortable for you. If you have a lot of these, I can see where using Web color notation may be convenient. But avoid macros.

Rob Napier
but how do i pass this web safe colour value in colorwithrgb method 33CC00
Rahul Vyas
Precisely as with the macro, by passing "0x33CC00". That's a legal integer, so you can pass it as a parameter.
Rob Napier
how do i pass that in [UIColor colorWithRed:66/255.0 green:33/255.0 blue:33/255.0 alpha:1.0]; this method
Rahul Vyas
A: 

Keep in mind that 33 != 0x33. The first is decimal notation and the second is hexadecimal. They're both valid, but they are different. Your second option should read

cell.textColor = [UIColor colorWithRed:0x66/255.0
                             green:0x33/255.0
                              blue:0x33/255.0
                             alpha:1.0];

or

cell.textColor = [UIColor colorWithRed:102/255.0
                             green:51/255.0
                              blue:51/255.0
                             alpha:1.0];
Eric Skroch