UITableViewCell separator insets don't work when table.width is much greater than view.width on iOS 10, I haven't try it on the device which iOS version is less then iOS 10.
You can add separator in your UITableView
using the below code
UIView* separatorLineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 3)];/// change size as you need.
separatorLineView.backgroundColor = [UIColor whiteColor];// you can also put image here
[cell.contentView addSubview:separatorLineView];
and remove the default separator of your UITableView
. Hope it helps.
_tableView.cellLayoutMarginsFollowReadableWidth = NO;
it works above.
refer to
iOS 9 UITableView separators insets (significant left margin)
There are two ways in which you can solve this problem.
First one you can add a separator line view in cell content view.
UIView* line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableview.frame.size.width, 3)];
line.backgroundColor = [UIColor whiteColor];
[cell.contentView addSubview:line];
The second one is apple provided one and pretty easy also just add this line of code where u declare your tableview
yourTableView.cellLayoutMarginsFollowReadableWidth = NO;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.