I am using xcode6.0.1.In my UIVIew Controller contains one tableview and i need to set separator inset full width.I changed my tableview separator inset via xib.But i can’t get full width for separator inset on my xcode6 (In my xcode5 separator inset full width is possible).How to solve this issue?
change tableview separator inset via xib
my tableview separator line like this(not get full width)
I solved my issue
-(void)viewDidLoad{
self.tableView.layoutMargins = UIEdgeInsetsZero;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if ([cell respondsToSelector:#selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
Use this method in iOS 8 [tableView setLayoutMargins:UIEdgeInsetsZero];
I guess you simulated your app in iOS8 , this is a new property "#property(nonatomic) UIEdgeInsets layoutMargins " in iOS8. I suggest you try to create a UITableViewCell class category(e.g. UITableViewCell+Separator) then add this getter
- (UIEdgeInsets)layoutMargins
{
return UIEdgeInsetsZero;
}
in iOS7 this will not be called cos there's no this property in SDK,and will not cause any crash; in iOS8 this will be called every time you use the cell
It works for me
Related
I have a UITableView with Custom Headers but I can't remove the bottom white line inside. The Separator property is set to none, in fact, the cells in the section don't have the line.
-(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
static NSString *CellIdentifier = #"DashboardSectionHeader";
UITableViewCell *headerView = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
...
return headerView;
}
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 60;
}
Have you checked DashboardSectionHeader cell?If there is a line at the bottom.Try changing the backgroundcolor of this cell and see.If the line is appearing in the section view ,then there should be say a one pixel space at the bottom of this cell through which the background will be visible.
I had the same issue in the same circumstances as you, and for me the problem have been solved by adding:
cell.contentView.clipsToBounds = NO;
in tableView: viewForHeaderInSection: method. Or you can just uncheck Clip Subview property in Attribute Inspector for your cells Content View (in Storyboard or xib file). FYI, I kept this property checked for my TableViewCell.
Apple has deprecated margins in table views, since iOS7, but designers still seem to want margins. What’s the best way t implement margins in iOS 7 and above? The old “group” table view style that included margins in iOS 6 no longer indents the left and right edges.
I have aUITableView subclass, in which i’m using the following method to programmatically add margins to the edge of all subviews, except thebackgroundView (such as cells, section header etc):
Code:
- (void)layoutSubviews {
[super layoutSubviews];
for (UIView *subview in self.subviews) {
if (subview != self.backgroundView && subview.frame.origin.x == 0.0 && subview.frame.size.width == self.frame.size.width) {
subview.frame = CGRectInset(subview.frame, 10.0, 0);
}
}
}
During runtime, it all seems to work as desired. The cells resize according to the margin offset and the subviews of those cells adjust correctly.
However, in the storyboard, usingIBDesignable, the cells adjust correctly but the cells’ subviews do not seem to resize within the cell’s calculated size
Is there a better way to implement margins in aUITableView?
Thanks c:
UIEdgeInsets is used to implement margins around the tableview that looks like grouped tableview. You may try below solutions and check it.
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];//iOS7
}
if ([tableView respondsToSelector:#selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:#selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
//OR
-(void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
// Force your tableview margins (this may be a bad idea)
if ([self.tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([self.tableView respondsToSelector:#selector(setLayoutMargins:)]) {
[self.tableView setLayoutMargins:UIEdgeInsetsZero];
}
}
For iOS 8 use
- (UIEdgeInsets)layoutMargins {
return UIEdgeInsetsZero;
}
Hope it helps you..
Apple switched to layout margins in iOS 8. The advantage of adding constraints to margins instead of edges, is that your margin is now adaptive, and will adjust itself, based on the screen's traits.
After I transitioned to constraining to margins (instead of edges), I really appreciated how it simplified layout, and eliminating having to adjust constraints myself. It does the work for me, and it looks pleasing.
I met this issue after I upgraded xcode to 6.3. The former build compiled using xcode 6.2 doesn't have this issue and works great.
The issue is: After switch to other tab and back, or back from push segue, the width of most cells will shrink a little bit. But some don't. And it looks like following
The label content in 2nd line of cell has the correct width. And all cells display content with the correct width after first launch.
In above image, there are two uitableviewcells.
content view : blue;
background view: light green;
content Label: purple;
The bg view and contentLabel in 1st cell shrinked. That's what I don't want.
I use storyboard to set the constraints.
bg view's constraints.
labelview's constraints
I also tried to cache the cell height as per this question UITableView layout messing up on push segue and return. (iOS 8, Xcode beta 5, Swift), but it doesn't work.
//In viewDidLoad
self.tableView.estimatedRowHeight = 100.0;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.contentInset = UIEdgeInsetsZero;
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath {
float height = [[self.estimatedRowHeightCache objectForKey:[NSString stringWithFormat:#"%ld", indexPath.row]] floatValue];
if (height) {
return height;
} else {
return UITableViewAutomaticDimension;
}
}
//cache row height. I observed this doesn't been called in first launching in debugging.
- (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
[self.estimatedRowHeightCache setValue:[NSNumber numberWithFloat:cell.frame.size.height] forKey:[NSString stringWithFormat:#"%ld", indexPath.row]];
}
Thanks for your help!
Well you are not setting the Horizontal Space Constraint for the view on top of your contentView. You are only setting Horizontal Space Constraint for your label and its superview.
Do this
Select the view which contains the label
Editor > Pin > Leading Space to SuperView
Implement DataSource Method for Tableview WillDisplayCell
Or you can implement in cell class (if it's custom cell) method - (void)awakeFromNib and there set cell frame.
I found a weird white space on UITableView for iPhone 6 Simulator (iOS 8) on Xcode 6 GM. I have tried to set the SeparatorInset from both storyboard and also the code, but the white space is till there.
The following code works on iOS 7 but not on iOS 8 (iPhone 6 simulator).
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
}
I attached screenshot below:
I am using AutoLayout by the way. I hope someone can show me a way to remove the weird white space on the TableView.
Thanks Student for pointing me to the right direction with the comment "Try this self.myTableView.layoutMargins = UIEdgeInsetsZero;" This line of code will only work on iOS 8 because layoutMargins is only available from iOS 8. If I run the same code on iOS 7, it will crash.
#property(nonatomic) UIEdgeInsets layoutMargins
Description The default spacing to use when laying out content in the view.
Availability iOS (8.0 and later)
Declared In UIView.h
Reference UIView Class Reference
Below is the right answer to solve this weird white space by setting the tableview layoutMargins and cell layoutMargins as UIEdgeInsetsZero if it exists (for iOS 8). And it will not crash on iOS 7 as well.
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([tableView respondsToSelector:#selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:#selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
See the screen shot below:-
Try to create a UITableViewCell class category and add this getter
- (UIEdgeInsets)layoutMargins {
return UIEdgeInsetsZero;
}
in iOS7 this will not be called cos there's no this property in SDK,and will not cause any crash;
in iOS8 this will be called every time you use the cell
It works for me
My solution with just three lines of code:
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)row{
//
// ... your code ...
//
if ([cell respondsToSelector:#selector(preservesSuperviewLayoutMargins)]){
cell.layoutMargins = UIEdgeInsetsZero;
cell.preservesSuperviewLayoutMargins = false;
}
return cell;
}
IOS8 introduce a new concept named Configuring Content Margins , a new property named layoutMargins is also introduced , for the details of the property , please refer to the Apple Doc . The type of layoutMargins is UIEdgeInsets , by default the value is {8,8,8,8} . To remove the seperator line of TableView in IOS8 , in addition to set tableView.seperatorInset = UIEdgeInsetsZero , you must also do as :
First define the macro
#define isIOS8SystemVersion (NSFoundationVersionNumber > NSFoundationVersionNumber_iOS_7_1)
In the UITableViewDelegate method add :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *reuseId = #"cellReuseID" ;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
if(!cell){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseId];
if(isIOS8SystemVersion){
cell.layoutMargins = UIEdgeInsetsZero;
cell.preservesSuperviewLayoutMargins =NO ;
}
}
Doing these will remove the seperator line . You can also do as follow :
UITableView *tableView = [[UITableView alloc] init];
if(isIOS8SystemVersion){
tableView.layoutMargins = UIEdgeInsetsZero ;
}
and in the UITableViewDelegate method add :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *reuseId = #"cellReuseID" ;
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
if(!cell){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseId];
if(isIOS8SystemVersion){
cell.layoutMargins = UIEdgeInsetsZero;
}
}
In my case in Xcode 6.2, in addition to Will Q's answer, I have to go to Main.storyboard > select the UITableViewCell > Attributes Inspector. Change Separator dropdown list from Default Insets to Custom Insets. Change the left inset from 15 to 0.
Workaround for iOS 7 & iOS 8
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.separatorInset = UIEdgeInsetsMake(0.0f, cell.frame.size.width, 0.0f, 0.0f);
}
In iOS8 you have to set the Inset both on Row and on Table level.
Row level in the cellForRowAtIndexPath:
if ([cell respondsToSelector:#selector(preservesSuperviewLayoutMargins)]){
cell.layoutMargins = UIEdgeInsetsZero;
cell.preservesSuperviewLayoutMargins = false;
}
Table level in the viewDidLoad:
[tableReference setSeparatorInset:UIEdgeInsetsZero];
After that it is a good idea to CLEAN your project. On some occasions I noted that these changes were not directly introduced in the executable App in the simulator.
for iOS 8
try by setting cell.layoutMargins = UIEdgeInsetsZero; in cellForRowAtIndexPath method
If you want to remove the white line, but keep separator inset as it is, just set the cell.backgroundColor to the tableView backgroundColor. Just setting the cell.contentView.backgroundColor does not make the problem disappear.
I've tried many ways, none of them work but this one works for me.
Add startup images for iPhone 6 and Plus. Before the images are added the phone is running in scaling mode, i.e. older Apps get scaled to fit the new screen sizes. This may be causing the lines.
The new images are Retina HD 5.5 (iPhone6Plus) 1242x2208 and Retina HD 4.7 (iPhone6) 750x1334.
See iOS 8 UITableView separator inset 0 not working
Basically, you need to set both the cell.layoutMargin as well as the tableView's layoutMargin. YMMV, but I had to set the table view up in layoutSubviews before it would work!
To make your UITableView separator insets to zero for both iOS7 and iOS8, instead of making a change in the code, make a change in the xib for the UITableView by changing the View->Mode->Aspect Fill.
I have static UITableView and wanted to shift the margin of a cell separator to the left edge.
Thanks to the above answers, this was my solution
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
// needed to shift the margin a specific cell to the left edge
if indexPath.section == 3 && indexPath.row == 0 {
cell.layoutMargins = UIEdgeInsetsZero
cell.preservesSuperviewLayoutMargins = false
cell.separatorInset = UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0)
}
}
Just add the following:
tableView.separatorStyle = .none
I noticed that in iOS 7, UITableViewCells have a line break in the separator of the cell that iOS 6 does not have. Is there a way to get rid of this line break? Changing the separator to none and then making UIViews with the color of the separator still causes the white separator to occur regardless.
For iOS7:
if ([self.tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
For iOS8:
First configure your table view as follows:
if ([self.tableView respondsToSelector:#selector(layoutMargins)]) {
self.tableView.layoutMargins = UIEdgeInsetsZero;
}
Then in your cellForRowAtIndexPath: method, configure the cell as follows:
if ([cell respondsToSelector:#selector(layoutMargins)]) {
cell.layoutMargins = UIEdgeInsetsZero;
}
Note: Include both layoutMargins and separatorInset, to support both iOS versions
You can also set the 'Separator Inset' from the storyboard:
If you want to support older versions of iOS, you should check for the availability of this method before calling it:
if ([self.tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:UIEdgeInsetsZero];
}
Figured it out.
[self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];
The selected answer did not work for me. But this yes and it works from ios 2.0:
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
Swift version
iOS introduces the layoutMargins property on cells AND table views.
This property isn't available in iOS 7.0 so you need to make sure you check before assigning it!
However, Apple has added a **property to your cell that will prevent it from inheriting your Table View's margin settings. This way, your cells can configure their own margins independently of the table view. Think of it as an override.
This property is called preservesSuperviewLayoutMargins, and setting it to NO can allow you to override your Table View's layoutMargin settings with your own cell's layoutMargin setting. It both saves time (you don't have to modify the Table View's settings), and is more concise. Please refer to Mike Abdullah's answer for a detailed explanation.
NOTE: this is the proper, less messy implementation, as expressed in Mike Abdullah's answer; setting your cell's preservesSuperviewLayoutMargins=NO will ensure that your Table View does not override the cell settings.
First step - Setup your cell margins:
/*
Tells the delegate the table view is about to draw a cell for a particular row.
*/
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell,
forRowAtIndexPath indexPath: NSIndexPath)
{
// Remove seperator inset
if cell.respondsToSelector("setSeparatorInset:") {
cell.separatorInset = UIEdgeInsetsZero
}
// Prevent the cell from inheriting the Table View's margin settings
if cell.respondsToSelector("setPreservesSuperviewLayoutMargins:") {
cell.preservesSuperviewLayoutMargins = false
}
// Explictly set your cell's layout margins
if cell.respondsToSelector("setLayoutMargins:") {
cell.layoutMargins = UIEdgeInsetsZero
}
}
Setting the preservesSuperviewLayoutMargins property on your cell to NO should prevent your table view from overriding your cell margins. In some cases, it seems to not function properly.
Second step - Only if all fails, you may brute-force your Table View margins:
/*
Called to notify the view controller that its view has just laid out its subviews.
*/
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
// Force your tableview margins (this may be a bad idea)
if self.tableView.respondsToSelector("setSeparatorInset:") {
self.tableView.separatorInset = UIEdgeInsetsZero
}
if self.tableView.respondsToSelector("setLayoutMargins:") {
self.tableView.layoutMargins = UIEdgeInsetsZero
}
}
...and there you go! This should work on iOS 8 as well as iOS 7.
Note: tested using iOS 8.1 and 7.1, in my case I only needed to use The First Step of this explanation.
The Second Step is only required if you have unpopulated cell beneath the rendered cells, ie. if the table is larger than the number of rows in the table model. Not doing the second step would result in different separator offsets.
For a permanent solution app-wide, call this in application:didFinishLaunching .. any tableview will be "fixed"
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
[[UITableView appearance]setSeparatorInset:UIEdgeInsetsZero];
}
And in iOS 8, based on the Seth McFarlane post here, you need to start dealing with layoutMargins. The following did it for me:
In ApplicationDidFinishLaunching, run the following:
if ([UITableViewCell instancesRespondToSelector:#selector(setLayoutMargins:)]) {
[[UITableViewCell appearance]setLayoutMargins:UIEdgeInsetsZero];
}
Create the following category on UITableView:
#interface UITableView(WJAdditions)
-(void) wjZeroSeparatorInset;
#end
#implementation UITableView (WJAdditions)
-(void) wjZeroSeparatorInset {
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
if ([self respondsToSelector:#selector(setLayoutMargins:)]) {
self.layoutMargins = UIEdgeInsetsZero;
}
#endif
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
if ([self respondsToSelector: #selector(setSeparatorInset:)])
self.separatorInset = UIEdgeInsetsZero;
}
#endif
}
#end
In your UITableViews, shortly after initializing, call
[self wjZeroSeparatorInset];
In your UITableViewControllers, you need the following:
-(void) viewWillLayoutSubviews {
[super viewWillLayoutSubviews];
UITableView* tv = self.tableView;
if ([tv respondsToSelector:#selector(setLayoutMargins:)]) {
[tv setLayoutMargins:UIEdgeInsetsZero];
}
}
In iOS 8, there appears to be a small bug. The custom value for separator inset doesn't get applied to the cells with text in it. I tried setting it from the interface builder and through code but neither worked. I've filed a bug report as well.
In the meantime, I have a small workaround to achieve this. I simply draw the line on the cell. Create a subclass of UITableViewCell and override the drawRect method. Also don't forget to set the separator property of the UITableView to None. Here is the code. It's in Swift but since its basically C, you can use the same thing in Objective-C as well.
override func drawRect(rect: CGRect) {
super.drawRect(rect)
let context = UIGraphicsGetCurrentContext()
CGContextSetStrokeColorWithColor(context, UITableView().separatorColor.CGColor) // seperator color
CGContextSetLineWidth(context, 2) // separator width
CGContextMoveToPoint(context, 0, self.bounds.size.height)
CGContextAddLineToPoint(context, self.bounds.size.width, self.bounds.size.height)
CGContextStrokePath(context)
}
Reset separatorInset fixes this problem for me:
if ([self.tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[self.tableView setSeparatorInset:self.tableView.separatorInset];
}
The solution:
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
if ([tableView respondsToSelector:#selector(setSeparatorInset:)]) {
[tableView setSeparatorInset:UIEdgeInsetsZero];
}
if ([tableView respondsToSelector:#selector(setLayoutMargins:)]) {
[tableView setLayoutMargins:UIEdgeInsetsZero];
}
if ([cell respondsToSelector:#selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
Beware as setting the separatorInset of tableView to UIEdgeInsetsZero seems to break the left margin of section titles at the same time! (at least it does on iOS 7.1)
If you want to display section titles with tableView:titleForHeaderInSection: and still get the desire effect of no line break between UITableViewCells, you must set the separatorInset directly on the cells instead of the tableView!
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// ...
[cell setSeparatorInset:UIEdgeInsetsZero];
For iOS8+ this worked for me,
tableView.layoutMargins = UIEdgeInsetsZero
and in cellForRowAtIndexPath method:
cell.layoutMargins = UIEdgeInsetsZero;
- (void)viewDidLoad
{
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
[super viewDidLoad];
// Additional setup
}
Note: the setSeparatorStyle line has to be above the super call.
#implementation UITableView (HGApperance)
-(void)setSeparatorXMargin:(CGFloat)margin{
// iOS 7
if ([self respondsToSelector:#selector(setSeparatorInset:)]) {
[self setSeparatorInset:UIEdgeInsetsZero];
}
if ([self respondsToSelector:#selector(layoutMargins)]) {
self.layoutMargins = UIEdgeInsetsZero;
}
}
#end
For TableviewCell, Willam's answer works perfect.
To iOS8 and above
If you find that all the solutions don't work like me, I think you may have used the subclass of UITableViewCell and override the layoutSubviews method, if you meet two the conditions, go on reading.
Do or check it step by step.
1、After alloc and init the UITableView, set its layoutMargins property.
if ([_tableView respondsToSelector:#selector(setLayoutMargins:)]) {
_tableView.layoutMargins = UIEdgeInsetsZero ;
}
2、In the method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath, after alloc and init your custom UITableViewCell, set its layoutMargins property.
if ([cell respondsToSelector:#selector(setLayoutMargins:)]) {
cell.layoutMargins = UIEdgeInsetsZero ;
}
3、The most important part comes in. If you override the - (void)layoutSubviews method of UITableViewCell, don't forget to call its super.
- (void)layoutSubviews
{
[super layoutSubviews] ;
// layout the subviews
}
Xamarin.iOS Version
I extended the UITableView separator the full width in Xamarin.iOS on iOS 8.4 with help from posts by Luis E. Prado and King-Wizard. I had to set both SeparatorInset and LayoutMargins to get it working. I did not write checks for lower iOS versions since I am targeting iOS 8 and above.
I wrote the following two C# extension methods to set the UITableView separator full width at the UITableView or UITableViewCell level. You might use one or both of these methods depending on the desired effect (see the explanations below).
UITableView
Set the UITableView properties to alter the separators that appear after empty cells. This SetLayoutMarginsZero method could be called from the related ViewController's ViewDidLoad method.
public static void SetLayoutMarginsZero(this UITableView tableView)
{
tableView.SeparatorInset = UIEdgeInsets.Zero;
tableView.LayoutMargins = UIEdgeInsets.Zero;
}
UITableViewCell
Set the UITableViewCell properties to alter the separators that appear after populated cells. This SetLayoutMarginsZero method could be called from the TableViewSource GetCell method.
public static void SetLayoutMarginsZero(this UITableViewCell tableViewCell)
{
tableViewCell.SeparatorInset = UIEdgeInsets.Zero;
tableViewCell.LayoutMargins = UIEdgeInsets.Zero;
tableViewCell.PreservesSuperviewLayoutMargins = false;
}