0

I made a static table view to be embed in a container view, the problem is that when the application start in the parent view controller the table view is scrolled down trunking the last item.I would like to see the first 3 items.

Here what i did try in the parent AND in the child view controller without any sucess :

public override void ViewDidLoad ()
    {
        base.ViewDidLoad ();

        //Juste une section pour cette table static
        int rowCount = TableView.NumberOfRowsInSection(0);
        NSIndexPath path = NSIndexPath.FromRowSection(rowCount - 1,0);
        TableView.ScrollToRow(path, UITableViewScrollPosition.Top, false);
        //TableView.ScrollEnabled = false;

    }

Here is an image of my problem :

Resume Thanks!!

Pilouk
  • 1,267
  • 1
  • 18
  • 36

1 Answers1

0
  1. Uncheck Adjust scroll View Inset on the embed view controller

  2. Use this code in the embed view controller :

        public override void ViewWillAppear(bool animated)
    {
        base.ViewWillAppear(animated);
    
        if (int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7)
        {
            RectangleF navFrame = this.NavigationController.NavigationBar.Frame;
            float blankTopSpace = navFrame.Location.Y + navFrame.Size.Height;
            TableView.ContentInset = new UIEdgeInsets(-blankTopSpace, 0, 0, 0);
        }
    
    }
    
Pilouk
  • 1,267
  • 1
  • 18
  • 36