user564968
user564968

Reputation:

how to set background color + opacity in table view cell + style is grouped

i have one tableview with style grouped. in this i set background color clearcolor

like this , cell.backgroundColor =[UIColor blackColor]; now i want this cell transparent. may be i can do this with opacity. but in this how can i set opacity.

i want same like this for cell background >>

enter image description here

here opacity . how can i do same this by coding in cell background ?

Upvotes: 3

Views: 10672

Answers (3)

Mirza Q Ali
Mirza Q Ali

Reputation: 747

//. Add this to viewdidload()

    tableView.backgroundColor = UIColor.black
    tableView.alpha = 0.65

Upvotes: 0

Ammar Mujeeb
Ammar Mujeeb

Reputation: 1311

Apart from the above answer. You can achieve transparency by simply setting cell's contentView alpha.

cell.backgroundColor = .black
cell.contentView.alpha = 0.5

Upvotes: 0

Seega
Seega

Reputation: 3390

You can use cell.alpha = 0; then your cell is invisible but all textLabels etc. to.
If you want only the cell.backgroundColor a bit transparent you can use
cell.backgroundColor = [UIColor colorWithRed:0. green:0.39 blue:0.106 alpha:0.]

Upvotes: 6

Related Questions