New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] ImageButton is half transparent when pressed #4947

Open
KarolStosikPowel opened this Issue Jan 10, 2019 · 1 comment

Comments

3 participants
@KarolStosikPowel
Copy link

KarolStosikPowel commented Jan 10, 2019

Description

On iOS, when ImageButton is in pressed state it's translucent. It should behave like on other platforms, and have a solid color.

My workaround (and probably fix):
Set UIButtonType to Custom
Set AdjustsImageWhenHighlighted to false

Code:

using Gemini.Changes.iOS.Renderers;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly: ExportRenderer(typeof(ImageButton), typeof(CustomImageButtonRenderer))]
namespace Gemini.Changes.iOS.Renderers
{
    public class CustomImageButtonRenderer : ImageButtonRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<ImageButton> e)
        {
            if (Control == null)
            {
                SetNativeControl(UIButton.FromType(UIButtonType.Custom));
                Control.AdjustsImageWhenHighlighted = false;
            }

            base.OnElementChanged(e);
        }
    }
}

Steps to Reproduce

  1. Use any ImageButton (for example from https://github.com/davidortinau/TheLittleThingsPlayground)
  2. Press ImageButton on iOS

Expected Behavior

Button should be smaller, but color should stay the same

Actual Behavior

Button is half transparent

Basic Information

  • Version with issue: 3.4.0.1009999, 3.4.0.1009999
  • Last known good version:
  • IDE: Visual Studio 15.9.4
  • Platform Target Frameworks:
    • iOS: 12.1
  • Affected Devices: iPhone
@kingces95

This comment has been minimized.

Copy link
Member

kingces95 commented Jan 10, 2019

Thanks! #4953

@kingces95 kingces95 closed this Jan 10, 2019

Triage automation moved this from New to Closed Jan 10, 2019

@samhouts samhouts reopened this Jan 11, 2019

Triage automation moved this from Closed to New Jan 11, 2019

@samhouts samhouts added this to In Progress in vNext (Target 3.5.0) Jan 11, 2019

@samhouts samhouts removed this from New in Triage Jan 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment