summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ButtonRenderer.cs26
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();
}
}