diff options
author | Chad Kimes <chad.kimes@iticentral.com> | 2017-01-26 10:13:27 +0100 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-02-17 10:45:36 +0000 |
commit | 7edc1013b1f343a3bff1b75f83cdff29ff15639c (patch) | |
tree | e3e6b99171e4c57b9ce0278827d2c95972922326 | |
parent | 986c46d0d410bb80a83ac37da0c68c2ad2f390b3 (diff) | |
download | xamarin-forms-7edc1013b1f343a3bff1b75f83cdff29ff15639c.tar.gz xamarin-forms-7edc1013b1f343a3bff1b75f83cdff29ff15639c.tar.bz2 xamarin-forms-7edc1013b1f343a3bff1b75f83cdff29ff15639c.zip |
[iOS] Fix extra tab icon appearing in iOS for TabbedPage (#448)
commit 1ba6ff67a745a0e802f67b7a4f36db4f8385466e
Merge: e3f1937 a1d4b64
Author: Stephane Delcroix <stephane@delcroix.org>
Date: Thu Jan 26 10:11:08 2017 +0100
Merge branch 'master' of git://github.com/ckimes89/Xamarin.Forms into ckimes89-master
commit a1d4b6485c51c0800e16d476ba8749bd1a0a6b28
Author: Chad Kimes <chad.kimes@iticentral.com>
Date: Tue Oct 11 13:42:28 2016 -0400
[iOS] Fix extra tab icon appearing in iOS 10
commit 07cd17df33aa9eb61e2507ca04ecf30d3416e16b
Author: Chad Kimes <chad.kimes@iticentral.com>
Date: Tue Oct 11 13:38:30 2016 -0400
[iOS] Add static check method for iOS 10
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Forms.cs | 12 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs index d51e1495..3969c0ff 100644 --- a/Xamarin.Forms.Platform.iOS/Forms.cs +++ b/Xamarin.Forms.Platform.iOS/Forms.cs @@ -37,6 +37,8 @@ namespace Xamarin.Forms static bool? s_isiOS9OrNewer; #endif + static bool? s_isiOS10OrNewer; + static Forms() { if (nevertrue) @@ -55,6 +57,16 @@ namespace Xamarin.Forms } #endif + internal static bool IsiOS10OrNewer + { + get + { + if (!s_isiOS10OrNewer.HasValue) + s_isiOS10OrNewer = UIDevice.CurrentDevice.CheckSystemVersion(10, 0); + return s_isiOS10OrNewer.Value; + } + } + public static void Init() { if (IsInitialized) diff --git a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs index 1470a934..2b8e70c4 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/TabbedRenderer.cs @@ -171,7 +171,9 @@ namespace Xamarin.Forms.Platform.iOS void OnPagePropertyChanged(object sender, PropertyChangedEventArgs e) { - if (e.PropertyName == Page.TitleProperty.PropertyName) + // Setting TabBarItem.Title in iOS 10 causes rendering bugs + // Work around this by creating a new UITabBarItem on each change + if (e.PropertyName == Page.TitleProperty.PropertyName && !Forms.IsiOS10OrNewer) { var page = (Page)sender; var renderer = Platform.GetRenderer(page); @@ -181,7 +183,7 @@ namespace Xamarin.Forms.Platform.iOS if (renderer.ViewController.TabBarItem != null) renderer.ViewController.TabBarItem.Title = page.Title; } - else if (e.PropertyName == Page.IconProperty.PropertyName) + else if (e.PropertyName == Page.IconProperty.PropertyName || e.PropertyName == Page.TitleProperty.PropertyName && Forms.IsiOS10OrNewer) { var page = (Page)sender; |