MT.Dialog FloatElement is not responsive on iOS7 only

JotharryDevelopmentJotharryDevelopment USMember ✭✭
edited February 2014 in Xamarin.iOS

I've just noticed this since I upgraded to iOS7 on my phone. Someone else has experienced the problem too (it's not just me imagining it :)) and posted on Stack Overflow

http://stackoverflow.com/questions/21416313/mt-dialog-floatelement-is-not-responsive

Unfortunately no-one has replied yet.

Anyone got any workarounds/solutions for this?

cheers

Posts

  • Ok, I've got a solution (of sorts). I created my own FloatElement and used my own slider inside it. I borrowed a tip from here

    http://www.mpatric.com/2009-04-15-more-responsive-sliders-on-the-iphone

    to come up with this, which works, but does feel a bit hacky. Not sure why the behaviour has changed in iOS7 though.

    public class Slidy : UISlider
    {
        private static int THUMB_SIZE = 10;
        private static int EFFECTIVE_THUMB_SIZE = 20;
        public Slidy(RectangleF r)
            : base(r)
        {
        }
    
        public override bool PointInside(PointF point, UIEvent uievent)
        {
            var bounds = this.Bounds;
            bounds = RectangleF.Inflate(bounds, 25, 25);
    
            return bounds.Contains(point);
        }
        public override bool BeginTracking(UITouch touch, UIEvent uievent)
        {    
            var bounds = this.Bounds;
            float thumbPercent = (this.Value - this.MinValue) / (this.MaxValue - this.MinValue);
            float thumbPos = THUMB_SIZE + (thumbPercent * (bounds.Size.Width - (2 * THUMB_SIZE)));
            var touchPoint = touch.LocationInView(this);
            return (touchPoint.X >= (thumbPos - EFFECTIVE_THUMB_SIZE) &&
            touchPoint.X <= (thumbPos + EFFECTIVE_THUMB_SIZE));
        }
    } 
    
Sign In or Register to comment.