using System; using System.ComponentModel; using System.Diagnostics; using System.Linq; using Foundation; using UIKit; using SizeF = CoreGraphics.CGSize; namespace Xamarin.Forms.Platform.iOS { public class ButtonRenderer : ViewRenderer { UIColor _buttonTextColorDefaultDisabled; UIColor _buttonTextColorDefaultHighlighted; UIColor _buttonTextColorDefaultNormal; bool _titleChanged; SizeF _titleSize; // This looks like it should be a const under iOS Classic, // but that doesn't work under iOS // ReSharper disable once BuiltInTypeReferenceStyle // Under iOS Classic Resharper wants to suggest this use the built-in type ref // but under iOS that suggestion won't work readonly nfloat _minimumButtonHeight = 44; // Apple docs public override SizeF SizeThatFits(SizeF size) { var result = base.SizeThatFits(size); if (result.Height < _minimumButtonHeight) { result.Height = _minimumButtonHeight; } return result; } protected override void Dispose(bool disposing) { if (Control != null) Control.TouchUpInside -= OnButtonTouchUpInside; base.Dispose(disposing); } protected override void OnElementChanged(ElementChangedEventArgs