public override void ViewDidLayoutSubviews() { base.ViewDidLayoutSubviews(); // set the search field and refresh button, cause those are known SearchField.Layer.Position = new CGPoint(10, 25); SearchField.ViewDidLayoutSubviews(new CGRect(0, 0, View.Bounds.Width * 0.3375f, View.Bounds.Height)); // position the clear button ClearButton.SizeToFit( ); ClearButton.Bounds = new CGRect(0, 0, ClearButton.Bounds.Width * 2, SearchButton.Bounds.Height); ClearButton.Layer.Position = new CGPoint(SearchField.Frame.Right - ClearButton.Bounds.Width, SearchField.Frame.Bottom + 10); // now set the search button, which will use remaining width SearchButton.Layer.Position = new CGPoint(10, SearchField.Frame.Bottom + 10); SearchButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, 0); SearchButton.SizeToFit( ); SearchButton.Frame = new CGRect(10, SearchField.Frame.Bottom + 10, SearchField.Bounds.Width - ClearButton.Bounds.Width - 2, SearchButton.Bounds.Height); // position the 'add family' button AddFamilyButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, SearchButton.Bounds.Height); AddFamilyButton.Layer.Position = new CGPoint(SearchButton.Frame.Left, SearchButton.Frame.Bottom + 10); // setup the table view nfloat tableXPos = SearchField.Frame.Right + 10; TableView.Frame = new CGRect(tableXPos, SearchField.Layer.Position.Y, View.Bounds.Width - tableXPos, View.Bounds.Height); TableView.SetNeedsLayout( ); BlockerView.SetBounds(View.Bounds.ToRectF( )); }
public void ViewDidLayoutSubviews(CGRect parentBounds) { // set the search field and refresh button, cause those are known SearchField.ViewDidLayoutSubviews(new CGRect(0, 0, parentBounds.Width * .80f, parentBounds.Height)); SearchField.Layer.Position = new CGPoint((parentBounds.Width - SearchField.Bounds.Width) / 2, 25); // now set the search button, which will use remaining width SearchButton.Layer.Position = new CGPoint(10, SearchField.Frame.Bottom + 10); SearchButton.Bounds = new CGRect(0, 0, SearchField.Bounds.Width, 0); SearchButton.SizeToFit( ); SearchButton.Frame = new CGRect((parentBounds.Width - SearchField.Bounds.Width) / 2, SearchField.Frame.Bottom + 10, SearchField.Bounds.Width, SearchButton.Frame.Height); nfloat currentYPos = SearchButton.Frame.Bottom + 25; // add all the families foreach (FamilyResult family in Results) { family.LayoutSubviews(parentBounds); family.SetPosition(new CGPoint((parentBounds.Width - family.GetFrame( ).Width) / 2, currentYPos)); currentYPos = family.GetFrame( ).Bottom + 25; } RootView.Bounds = new CGRect(0, 0, parentBounds.Width, currentYPos); }