public void Reload() { Container.RemoveConstraints(Container.Constraints); foreach (var v in Container.Subviews) { v.RemoveFromSuperview(); } var format = "V:|"; var views = new NSMutableDictionary(); var metrics = new NSMutableDictionary(); if (Toolbar != null) { metrics["toolbarTop"] = NSNumber.FromNFloat(ToolbarEdgeInsets.Top); metrics["toolbarBottom"] = NSNumber.FromNFloat(ToolbarEdgeInsets.Bottom); format += "-(toolbarTop)-[toolbar]-(toolbarBottom)"; views["toolbar"] = Toolbar; Container.Layout(Toolbar).Horizontally(ToolbarEdgeInsets.Left, ToolbarEdgeInsets.Right); } if (ContentView != null) { metrics["contentViewBottom"] = NSNumber.FromNFloat(ContentViewEdgeInsets.Bottom); if (Toolbar != null) { metrics["toolbarBottom"] = NSNumber.FromNFloat((metrics["toolbarBottom"] as NSNumber).NFloatValue + ContentViewEdgeInsets.Top); format += "-[contentView]-(contentViewBottom)"; } else { metrics["contentViewTop"] = NSNumber.FromNFloat(ContentViewEdgeInsets.Top); format += "-(contentViewTop)-[contentView]-(contentViewBottom)"; } views["contentView"] = ContentView; Container.Layout(ContentView).Horizontally(ContentViewEdgeInsets.Left, ContentViewEdgeInsets.Right); ContentView.Grid().Reload(); ContentView.Divider().Reload(); } if (BottomBar != null) { metrics["bottomBarBottom"] = NSNumber.FromNFloat(BottomBarEdgeInsets.Bottom); if (ContentView != null) { metrics["contentViewBottom"] = NSNumber.FromNFloat((metrics["contentViewBottom"] as NSNumber).FloatValue + BottomBarEdgeInsets.Top); format += "-[bottomBar]-(bottomBarBottom)"; } else if (Toolbar != null) { metrics["toolbarBottom"] = NSNumber.FromNFloat((metrics["toolbarBottom"] as NSNumber).FloatValue + BottomBarEdgeInsets.Top); format += "-[bottomBar]-(bottomBarBottom)"; } else { metrics["bottomBarTop"] = NSNumber.FromNFloat(BottomBarEdgeInsets.Top); format += "-(bottomBarTop)-[bottomBar]-(bottomBarBottom)"; } views["bottomBar"] = BottomBar; Container.Layout(BottomBar).Horizontally(BottomBarEdgeInsets.Left, BottomBarEdgeInsets.Right); } if (views.Count > 0) { Container.AddConstraints(Layout.Constraint(string.Format("{0}-|", format), 0, metrics, views)); } //if (TitleLabel != null) //{ // verticalFormat += "-(insetTop)"; // metrics["insetTop"] = NSNumber.FromNFloat(ContentInset.Top + TitleLabelInset.Top); //} //else if (ContentView != null) //{ // verticalFormat += "-(insetTop)"; // metrics["insetTop"] = NSNumber.FromNFloat(ContentInset.Top + ContentViewEdgeInsets.Top); //} //if (TitleLabel != null) //{ // verticalFormat += "-[titleLabel]"; // views["titleLabel"] = TitleLabel; // this.Layout(TitleLabel).Horizontally(left: ContentInset.Left + TitleLabelInset.Left, right: ContentInset.Right + TitleLabelInset.Right); //} //if (ContentView != null) //{ // if (TitleLabel == null) // { // metrics["insetTop"] = NSNumber.FromNFloat((metrics["insetTop"] as NSNumber).NFloatValue + ContentViewEdgeInsets.Top); // } // else // { // verticalFormat += "-(insetB)"; // metrics["insetB"] = NSNumber.FromNFloat(TitleLabelInset.Bottom + ContentViewEdgeInsets.Top); // } // verticalFormat += "-[contentView]"; // views["contentView"] = ContentView; // this.Layout(ContentView).Horizontally(left: ContentInset.Left + ContentViewEdgeInsets.Left, right: ContentInset.Right + ContentViewEdgeInsets.Right); //} //if (LeftButtons != null && LeftButtons.Length > 0) //{ // var h = "H:|"; // var d = new NSMutableDictionary(); // var i = 0; // foreach (var b in LeftButtons) // { // var k = String.Format("b{0}", i); // d[k] = b; // if (i == 0) // { // h += "-(left)-"; // } // else // { // h += "-(left_right)-"; // } // h += String.Format("[{0}]", k); // this.Layout(b).Bottom(ContentInset.Bottom + LeftButtonsInset.Bottom); // i += 1; // } // AddConstraints(Layout.Constraint(h, 0, NSDictionary.FromObjectsAndKeys( // new object[] { ContentInset.Left + LeftButtonsInset.Left, LeftButtonsInset.Left + LeftButtonsInset.Right }, // new object[] { "left", "left_right" } // ), d)); //} //if (RightButtons != null && RightButtons.Length > 0) //{ // var h = "H:|"; // var d = new NSMutableDictionary(); // var i = RightButtons.Length - 1; // foreach (var b in LeftButtons) // { // var k = String.Format("b{0}", i); // d[k] = b; // if (i == 0) // { // h += "-(right)-"; // } // else // { // h += "-(right_left)-"; // } // h += String.Format("[{0}]", k); // this.Layout(b).Bottom(ContentInset.Bottom + RightButtonsInset.Bottom); // i -= 1; // } // AddConstraints(Layout.Constraint(h + "|", 0, NSDictionary.FromObjectsAndKeys( // new object[] { ContentInset.Right + RightButtonsInset.Right, RightButtonsInset.Right + RightButtonsInset.Left }, // new object[] { "right", "right_left" } // ), d)); //} //if (LeftButtons != null && LeftButtons.Length > 0) //{ // verticalFormat += "-(insetC)-[button]"; // views["button"] = LeftButtons[0]; // metrics["insetC"] = NSNumber.FromNFloat(LeftButtonsInset.Top); // metrics["insetBottom"] = NSNumber.FromNFloat(ContentInset.Bottom + LeftButtonsInset.Bottom); //} //else if (RightButtons != null && RightButtons.Length > 0) //{ // verticalFormat += "-(insetC)-[button]"; // views["button"] = RightButtons[0]; // metrics["insetC"] = NSNumber.FromNFloat(RightButtonsInset.Top); // metrics["insetBottom"] = NSNumber.FromNFloat(ContentInset.Bottom + RightButtonsInset.Bottom); //} //if (ContentView != null) //{ // if (metrics["insetC"] == null) // { // metrics["insetBottom"] = NSNumber.FromNFloat(ContentInset.Bottom + ContentViewEdgeInsets.Bottom + (Divider ? DividerInset.Top + DividerInset.Bottom : 0)); // } // else // { // metrics["insetC"] = NSNumber.FromNFloat((metrics["insetC"] as NSNumber).NFloatValue + ContentViewEdgeInsets.Bottom + (Divider ? DividerInset.Top + DividerInset.Bottom : 0)); // } //} //else if (TitleLabel != null) //{ // if (metrics["insetC"] == null) // { // metrics["insetBottom"] = NSNumber.FromNFloat(ContentInset.Bottom + TitleLabelInset.Bottom + (Divider ? DividerInset.Top + DividerInset.Bottom : 0)); // } // else // { // metrics["insetC"] = NSNumber.FromNFloat((metrics["insetC"] as NSNumber).NFloatValue + TitleLabelInset.Bottom + (Divider ? DividerInset.Top + DividerInset.Bottom : 0)); // } //} //else if (metrics["insetC"] != null) //{ // metrics["insetC"] = NSNumber.FromNFloat((metrics["insetC"] as NSNumber).NFloatValue + ContentInset.Bottom + (Divider ? DividerInset.Top + DividerInset.Bottom : 0)); //} //if (views.Count > 0) //{ // verticalFormat += "-(insetBottom)-|"; // AddConstraints(Layout.Constraint(verticalFormat, 0, metrics, views)); //} }