Roman Volkov
Roman Volkov

Reputation: 237

How to set color for separator for UITableView

How I can set the color of separator of sections? I set all posible colors to "f5f5f5", but the separator is "ededed". Why it can be?

enter image description here

Upvotes: 0

Views: 2105

Answers (3)

Amit Jagesha シ
Amit Jagesha シ

Reputation: 1112

Objective c

- (void)viewDidLoad
 {     
  [self.tableView setSeparatorColor:[UIColor redColor]];
 }

Swift

func viewDidLoad()
{
 self.tableview.separatorColor = UIColor.redColor
}

Upvotes: 1

ADK
ADK

Reputation: 139

To change color of Separator:

self.tableview.separatorColor = UIColor.redColor

I hope it helps!

Upvotes: 0

Josué H.
Josué H.

Reputation: 1191

You can create an Extension to set a Shadow in your UITableVIewCell

extension UIView {
public func applyShadow(
    withOpacity opacity: Float = 0.4,
                offset: CGSize = CGSizeMake(2.0, 0.5),
                radius: CGFloat = 3.0) -> Void {

    self.layer.shadowOpacity = opacity
    self.layer.shadowOffset = offset
    self.layer.shadowRadius = radius
}

You can use this extension. cell.applyShadow()

Upvotes: 0

Related Questions