Created
December 5, 2017 21:14
-
-
Save rdelrosario/50fb790115ff4e9f5a58b738755c0080 to your computer and use it in GitHub Desktop.
iOS Bar Setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ViewWillAppear(bool animated) | |
{ | |
base.ViewWillAppear(animated); | |
SetupNavBar(NavigationController.NavigationBar.Bounds.Size); | |
SetTitlePosition(CustomNavigationPage.GetTitlePosition(Element), CustomNavigationPage.GetTitlePadding(Element), CustomNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f)))); | |
System.Diagnostics.Debug.WriteLine("Preparing"); | |
} | |
public override void ViewDidLayoutSubviews() | |
{ | |
base.ViewDidLayoutSubviews(); | |
if(lastNavBarWidth != NavigationController?.NavigationBar?.Bounds.Size.Width || lastNavBarHeight != NavigationController?.NavigationBar?.Bounds.Size.Height) | |
{ | |
lastNavBarHeight = NavigationController?.NavigationBar?.Bounds.Size.Height ?? 0.0f; | |
lastNavBarWidth = NavigationController?.NavigationBar?.Bounds.Size.Width ?? 0.0f; | |
SetupNavBar(new CGSize(lastNavBarWidth, lastNavBarHeight)); | |
} | |
SetTitlePosition( CustomNavigationPage.GetTitlePosition(Element), CustomNavigationPage.GetTitlePadding(Element),CustomNavigationPage.GetTitleMargin(Element), new CGRect(0, 0, Math.Max(subtitleLabel.IntrinsicContentSize.Width, titleLabel.IntrinsicContentSize.Width), (titleLabel.IntrinsicContentSize.Height + subtitleLabel.IntrinsicContentSize.Height + (subtitleLabel.IntrinsicContentSize.Height > 0.0f ? 3.0f : 0.0f)))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment