Remove unwanted margin at top of grouped UITableView, custom UIViewController

JuliusvanMansveltJuliusvanMansvelt USMember ✭✭
edited May 2017 in Xamarin.Forms

Every post I've seen either tells me to change the topheaderview, something like this
var frame = CoreGraphics.CGRect.Empty;
frame.Height = 1;
tbl.TableHeaderView = new UIView(frame);

Or to change the AutomaticallyAdjustsScrollViewInsets to false or NO, which is located in UIViewController. I've tried to override ViewDidLoad in UIViewController, but for some reason the code doesn't even run, I put a breakpoint at base.ViewDidLoad and it's never called.

Does this look right?

[assembly: ExportRenderer(typeof(UIViewController), typeof(MyUIViewController))]

namespace Domstol.iOS
{
public class MyUIViewController : UIViewController
{
public override void ViewDidLoad()
{
base.ViewDidLoad();
this.AutomaticallyAdjustsScrollViewInsets = false;
}
}
}

Best Answer

  • JuliusvanMansveltJuliusvanMansvelt US ✭✭
    Accepted Answer

    Can someone delete this post? It miraculously solved itself with the code below
    var frame = CoreGraphics.CGRect.Empty;
    frame.Height = 1;
    tbl.TableHeaderView = new UIView(frame);

Answers

  • JuliusvanMansveltJuliusvanMansvelt USMember ✭✭
    Accepted Answer

    Can someone delete this post? It miraculously solved itself with the code below
    var frame = CoreGraphics.CGRect.Empty;
    frame.Height = 1;
    tbl.TableHeaderView = new UIView(frame);

Sign In or Register to comment.