diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2017-06-21 03:00:58 +0200 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-06-21 02:00:58 +0100 |
commit | b7b0bf559ad8759110231d73ead0f19e53de5df7 (patch) | |
tree | 82502b3650b80d49361c967dad74538498aaba70 /Xamarin.Forms.Platform.iOS | |
parent | 723cb80c6b0eaa587f00fc6ba38dcd1887e6943d (diff) | |
download | xamarin-forms-b7b0bf559ad8759110231d73ead0f19e53de5df7.tar.gz xamarin-forms-b7b0bf559ad8759110231d73ead0f19e53de5df7.tar.bz2 xamarin-forms-b7b0bf559ad8759110231d73ead0f19e53de5df7.zip |
[iOS] workaround a weird iOS behavior. (#987)
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs | 12 |
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 83a7b5d0..c240dd50 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) |