summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
diff options
context:
space:
mode:
authoradrianknight89 <adrianknight89@outlook.com>2017-02-15 11:39:02 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-02-15 11:39:02 (GMT)
commit1d8e098e2a85d5f82eeb816f7e12c3c8e9381262 (patch)
treea747aa4fb24f5d41fb59a4325319adf1a70d7efb /Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
parent340a705c5e2f912f97e8e276215de4ff20583e59 (diff)
downloadxamarin-forms-1d8e098e2a85d5f82eeb816f7e12c3c8e9381262.zip
xamarin-forms-1d8e098e2a85d5f82eeb816f7e12c3c8e9381262.tar.gz
xamarin-forms-1d8e098e2a85d5f82eeb816f7e12c3c8e9381262.tar.bz2
[iOS] MasterDetailPage master icon should be changeable from any page on the stack (#608)
* master detail page master icon could be changed from any page on the stack * change icon names * added titles
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs15
1 files changed, 14 insertions, 1 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
index b26e314..fbadc77 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/PhoneMasterDetailRenderer.cs
@@ -218,7 +218,7 @@ namespace Xamarin.Forms.Platform.iOS
void HandleMasterPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == Page.IconProperty.PropertyName || e.PropertyName == Page.TitleProperty.PropertyName)
- MessagingCenter.Send<IVisualElementRenderer>(this, NavigationRenderer.UpdateToolbarButtons);
+ UpdateLeftBarButton();
}
void HandlePropertyChanged(object sender, PropertyChangedEventArgs e)
@@ -321,6 +321,19 @@ namespace Xamarin.Forms.Platform.iOS
SetNeedsStatusBarAppearanceUpdate();
}
+ void UpdateLeftBarButton()
+ {
+ var masterDetailPage = Element as MasterDetailPage;
+ if (!(masterDetailPage?.Detail is NavigationPage))
+ return;
+
+ var detailRenderer = Platform.GetRenderer(masterDetailPage.Detail) as UINavigationController;
+
+ UIViewController firstPage = detailRenderer?.ViewControllers.FirstOrDefault();
+ if (firstPage != null)
+ NavigationRenderer.SetMasterLeftBarButton(firstPage, masterDetailPage);
+ }
+
public override UIViewController ChildViewControllerForStatusBarHidden()
{
if (((MasterDetailPage)Element).Detail != null)