diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-12-14 12:38:46 -0800 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-12-14 20:38:46 +0000 |
commit | 9535315986c6ad5d51ec28f676310b9a5f7d444c (patch) | |
tree | d0492d1c6c35581040ca76aff4dc577c7227c840 /Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs | |
parent | eca25db80eebc2e7936f154246ed7996f6d071a1 (diff) | |
download | xamarin-forms-9535315986c6ad5d51ec28f676310b9a5f7d444c.tar.gz xamarin-forms-9535315986c6ad5d51ec28f676310b9a5f7d444c.tar.bz2 xamarin-forms-9535315986c6ad5d51ec28f676310b9a5f7d444c.zip |
Deprecate versions of iOS older than 8 (#630)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs index 8d043bac..68d4702d 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs @@ -82,8 +82,6 @@ namespace Xamarin.Forms.Platform.iOS UpdateFont(); else if (e.PropertyName == Button.BorderWidthProperty.PropertyName || e.PropertyName == Button.BorderRadiusProperty.PropertyName || e.PropertyName == Button.BorderColorProperty.PropertyName) UpdateBorder(); - else if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName) - UpdateBackgroundVisibility(); else if (e.PropertyName == Button.ImageProperty.PropertyName) UpdateImage(); } @@ -93,18 +91,6 @@ namespace Xamarin.Forms.Platform.iOS ((IButtonController)Element)?.SendClicked(); } - void UpdateBackgroundVisibility() - { - if (Forms.IsiOS7OrNewer) - return; - - var model = Element; - var shouldDrawImage = model.BackgroundColor == Color.Default; - - foreach (var control in Control.Subviews.Where(sv => !(sv is UILabel))) - control.Alpha = shouldDrawImage ? 1.0f : 0.0f; - } - void UpdateBorder() { var uiButton = Control; @@ -115,8 +101,6 @@ namespace Xamarin.Forms.Platform.iOS uiButton.Layer.BorderWidth = Math.Max(0f, (float)button.BorderWidth); uiButton.Layer.CornerRadius = button.BorderRadius; - - UpdateBackgroundVisibility(); } void UpdateFont() @@ -142,10 +126,7 @@ namespace Xamarin.Forms.Platform.iOS UIButton button = Control; if (button != null && uiimage != null) { - if (Forms.IsiOS7OrNewer) - button.SetImage(uiimage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal); - else - button.SetImage(uiimage, UIControlState.Normal); + button.SetImage(uiimage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal); button.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit; @@ -184,9 +165,8 @@ namespace Xamarin.Forms.Platform.iOS Control.SetTitleColor(Element.TextColor.ToUIColor(), UIControlState.Normal); Control.SetTitleColor(Element.TextColor.ToUIColor(), UIControlState.Highlighted); Control.SetTitleColor(_buttonTextColorDefaultDisabled, UIControlState.Disabled); - - if (Forms.IsiOS7OrNewer) - Control.TintColor = Element.TextColor.ToUIColor(); + + Control.TintColor = Element.TextColor.ToUIColor(); } } |