diff options
author | Rui Marinho <me@ruimarinho.net> | 2016-06-16 17:20:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-16 17:20:12 +0100 |
commit | 87f1418d2ffe1913a0b1c312119d839a5bb234ba (patch) | |
tree | 40ab7198b1000683f90fa27da12c3495165e5a12 /Xamarin.Forms.Platform.iOS | |
parent | ed517a3027fb8a273b1f4226622cf88378091cd9 (diff) | |
download | xamarin-forms-87f1418d2ffe1913a0b1c312119d839a5bb234ba.tar.gz xamarin-forms-87f1418d2ffe1913a0b1c312119d839a5bb234ba.tar.bz2 xamarin-forms-87f1418d2ffe1913a0b1c312119d839a5bb234ba.zip |
[iOS] Call UpdateLeftBarButtonItem when page is removed (#209)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs index be069e98..d0798ed3 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationRenderer.cs @@ -525,6 +525,8 @@ namespace Xamarin.Forms.Platform.iOS _removeControllers = _removeControllers.Remove(target); ViewControllers = _removeControllers; } + var parentingViewController = ViewControllers.Last() as ParentingViewController; + UpdateLeftBarButtonItem(parentingViewController, page); } void RemoveViewControllers(bool animated) @@ -629,11 +631,13 @@ namespace Xamarin.Forms.Platform.iOS } } - void UpdateLeftBarButtonItem(ParentingViewController containerController) + void UpdateLeftBarButtonItem(ParentingViewController containerController, Page pageBeingRemoved = null) { + if (containerController == null) + return; var currentChild = containerController.Child; var firstPage = ((INavigationPageController)Element).StackCopy.LastOrDefault(); - if ((currentChild != firstPage && NavigationPage.GetHasBackButton(currentChild)) || _parentMasterDetailPage == null) + if ((firstPage != pageBeingRemoved && currentChild != firstPage && NavigationPage.GetHasBackButton(currentChild)) || _parentMasterDetailPage == null) return; if (!_parentMasterDetailPage.ShouldShowToolbarButton()) |