iosobjective-cuitableviewuicolorcgcolor

How to transparency border color for tableview?


I have successfully changed the color of my UIButton using alpha, but when I try to do the same for my tableview it doesn't work.

_tablemenu.layer.borderWidth = 2;
_tableview.layer.borderWidth = 5;
_tableview.layer.borderColor = [UIColor colorWithRed:0xCC green:0xFF blue:0x99 alpha:0.5].CGColor;
_tablemenu.layer.borderColor = [UIColor greenColor].CGColor;

The code is working fine for _tablemenu,but when i try to initialize a UIColor with RGB values it doesn't work.


Solution

  • you have to give value between 0 to 1 in R,G and B

    _tableview.layer.borderColor=[UIColor colorWithRed:204/255.0 green:255/255.0 blue:153/255.0 alpha:0.5].CGColor;