我有以下自定义大小的LeftBarButtonItem,有时它没有响应我的触摸,例如60%的响应时间
UIImage yourBackImage = UIImage.FromBundle("back-button");
var newSize = new CGSize(20, 20);
UIGraphics.BeginImageContextWithOptions(newSize, false, 0.0f);
yourBackImage.Draw(new CGRect(0, 0, newSize.Width, newSize.Height));
UIImage resizeImage = UIGraphics.GetImageFromCurrentImageContext();
UIGraphics.EndImageContext();
UIButton backButton = new UIButton(UIButtonType.System);
backButton.SetImage(resizeImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
backButton.Frame = new CoreGraphics.CGRect(0, 0, 44, 44);
backButton.TouchUpInside += delegate
{
DetailController dc = new DetailController();
NavigationController.PushViewController(dc, false);
};
backButton.ImageEdgeInsets = new UIEdgeInsets(top: 0, left: -13.0f, bottom: 0, right: 13.0f);
backButton.WidthAnchor.ConstraintEqualTo(44.0f).Active = true;
backButton.HeightAnchor.ConstraintEqualTo(44.0f).Active = true;
NavigationItem.LeftBarButtonItem = new UIBarButtonItem(backButton);