summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2017-06-21 01:00:58 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-06-21 01:00:58 (GMT)
commitb7b0bf559ad8759110231d73ead0f19e53de5df7 (patch)
tree82502b3650b80d49361c967dad74538498aaba70 /Xamarin.Forms.Platform.iOS
parent723cb80c6b0eaa587f00fc6ba38dcd1887e6943d (diff)
downloadxamarin-forms-b7b0bf559ad8759110231d73ead0f19e53de5df7.zip
xamarin-forms-b7b0bf559ad8759110231d73ead0f19e53de5df7.tar.gz
xamarin-forms-b7b0bf559ad8759110231d73ead0f19e53de5df7.tar.bz2
[iOS] workaround a weird iOS behavior. (#987)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
index 83a7b5d..c240dd5 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs
@@ -17,6 +17,18 @@ namespace Xamarin.Forms.Platform.iOS
Frame = new RectangleF(0, 20, 320, 40);
}
+ public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
+ {
+ //with borderStyle set to RoundedRect, iOS always returns a height of 30
+ //https://stackoverflow.com/a/36569247/1063783
+ //we get the current value, and restor it, to allow custom renderers to change the border style
+ var borderStyle = Control.BorderStyle;
+ Control.BorderStyle = UITextBorderStyle.None;
+ var size = Control.GetSizeRequest(widthConstraint, double.PositiveInfinity);
+ Control.BorderStyle = borderStyle;
+ return size;
+ }
+
IElementController ElementController => Element as IElementController;
protected override void Dispose(bool disposing)