Emrah Akgül
Emrah Akgül

Reputation: 630

How to set specific UITableViewCell separator position?

My question is I want my table view cell's separator to begin from specific position. Here is a visualization of what I want:

enter image description here

While I was searching, I found some questions about how to start separator line from beginning of the cell and explanations were made saying giving custom insets. I supposed same should work for me and I tried giving custom insets from interface builder. However it did not work.

Is there any solution for that?

Upvotes: 3

Views: 954

Answers (2)

Nguyen Hoan
Nguyen Hoan

Reputation: 1693

i try and it work , in swift

    self.tableView.separatorInset = UIEdgeInsets(top: 0, left: 35, bottom: 0, right: 0)

in Objective C:

  self.tableView.separatorInset = UIEdgeInsetsMake(0, 80, 0, 0);

Upvotes: 5

sbarow
sbarow

Reputation: 2819

You can do it in Interface Builder. In the Attributes Inspector look for indentation and set it to what ever you want.

enter image description here

Upvotes: 1

Related Questions