UITableview separator inset resets to default width upon scrolling

I have tried to set the separator inset on the right. Upon the first run of the project and before scrolling the tableview, everything appears smooth. But then as soon as the scrolling happens once, the separator inset of the last row in each section resizes to take the full width. The code used is as below : In

viewDidLoad
:

myTable.separatorColor =[UIColor redColor];

[myTable setSeparatorInset:UIEdgeInsetsMake(0,0,0,40)];

Inside

cellForRowAtIndexPath
:

[tableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,40)];

cell.separatorInset =UIEdgeInsetsMake(0,0,0,40);

I tried putting the same code in almost all other delegate/datasource methods of

UITableView
but to no avail.

To do the inset thingy in the headerview of the table, I have added two

UILabel
upper and lower with restricted frame width in
viewForHeaderInSection
(height of header being 40):

UILabel*upperBorder =[[UILabel alloc]initWithFrame:CGRectMake(0,0,280.0,1.0)];

[upperBorder setBackgroundColor:[UIColor blackColor]];

[headerView addSubview:upperBorder];

UILabel*lowerBorder =[[UILabel alloc]initWithFrame:CGRectMake(0,39.0,280.0,1.0)];

[lowerBorder setBackgroundColor:[UIColor blackColor]];

[headerView addSubview:lowerBorder];

I have put the images before and after scrolling.

Before scrolling :

User uploaded file


After scrolling :

User uploaded file


Any help in this regard is appreciated. I simply need to make the table look like the first pic even after scrolling i.e. to retain the edge inset in the right side no matter what. Thanks in advance.

iPhone 5s, iOS 7

Posted on Sep 8, 2014 1:00 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

UITableview separator inset resets to default width upon scrolling

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.