Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

ios - Change color of inset area in UITableView separator

I have a customized UITableView, the cells have a different background color (set in a custom backgroundView). However, the background color is only applied within the cell, but not extended to the inset area of the separator. As you can see in the screenshot, there is a white area to the left of the colored separator.

How can we change the color of this white line? We would like to make the line "disappear" by setting it to the same color as the cell background. Thanks!

enter image description here

question from:https://stackoverflow.com/questions/22224700/change-color-of-inset-area-in-uitableview-separator

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Setting the cell's background colour to the same as the contentView's background colour seems to give the best results.

cell.backgroundColor = cell.contentView.backgroundColor;

That will handle cases where the accessoryView is the wrong colour as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...