From b7b0bf559ad8759110231d73ead0f19e53de5df7 Mon Sep 17 00:00:00 2001 From: Stephane Delcroix Date: Wed, 21 Jun 2017 03:00:58 +0200 Subject: [iOS] workaround a weird iOS behavior. (#987) --- Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Xamarin.Forms.Platform.iOS') 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) -- cgit v1.2.3