I am new in iOS. I have a View on top (width 1 px height) and a UITableView below the View.
Now, The constraint leading and trailing of the View is 10
I have tried to set the Separator Inset for the TableView with value Left is 10 and Right is 10 but it not work well (the view width is not equal to TableView Separator width).
I want to set the width of the View equal to the width of the UITableView Separator.
What should I do to achieve it? Any help would be appreciated

Try this , You can set the separator inset in your custom tableviewCell class by adding the below method,
- (UIEdgeInsets)layoutMargins
{
return UIEdgeInsetsMake(0, 10, 0, 10);
}
Then set your view's leading and trailing constraints by 10px.
I think it relate with margin property. Make sure you that when you set constraint, you already uncheck this option like this

And this:

And in controller set separatorinset:
self.tableView.separatorInset = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
Hope this help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With