I want to use a disclosure button on my table view cell. Therefore I use this custom renderer:
using HelloXamarinFormsWorld;
using HelloXamarinFormsWorld.iOS;
using UIKit;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using System.Drawing;
using ObjCRuntime;
/* Example of using a custom renderer to get the > disclosure indicator to appear */
[assembly: ExportRenderer (typeof (EmployeeCell), typeof (EmployeeCellRenderer))]
namespace HelloXamarinFormsWorld.iOS
{
public class EmployeeCellRenderer : ViewCellRenderer
{
public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
{
var cell = base.GetCell (item, reusableCell, tv);
cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
// // Remove seperator inset
// if (cell.RespondsToSelector (new Selector ("setSeparatorInset:"))) {
// cell.SeparatorInset = UIEdgeInsets.Zero;
// }
// // Prevent the cell from inheriting the Table View's margin settings
// if (cell.RespondsToSelector (new Selector ("setPreservesSuperviewLayoutMargins:"))) {
// cell.PreservesSuperviewLayoutMargins = false;
// }
// // Explictly set your cell's layout margins
// if (cell.RespondsToSelector (new Selector ("setLayoutMargins:"))) {
// cell.LayoutMargins = UIEdgeInsets.Zero;
// }
return cell;
}
}
}
If I set the disclosure indicator I get the following screen:
Normally it does look like the following
I tried to play with the inset, but that has to be in WillDisplay
and also the indentation is not removed. In this thread rmarinho states
you can fix by setting the UIEdgeInsets i think , i use the Padding property on ExtendedViewCell for this.
but I don't know where I should do this. Or how do I fix the indentation?
Edit:
Using cell.SeparatorInset = new UIEdgeInsets(0,0,0,0);
didn't help.