Bug 58267 - UILongPressGestureRecognizer for an oxyplot doesn't work just on iPhone 7
Summary: UILongPressGestureRecognizer for an oxyplot doesn't work just on iPhone 7
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-07-20 10:28 UTC by kongara.krishna.c
Modified: 2017-07-20 23:17 UTC (History)
2 users (show)

Tags: xamarin.iOS, iPhone7, UILongPressGestureRecognizer, oxyplot
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description kongara.krishna.c 2017-07-20 10:28:32 UTC
using System;
using CoreGraphics;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
using OxyPlot.Xamarin.iOS;
using UIKit;
namespace longpress.iOS
{
 public partial class ViewController : UIViewController
 {
    UILongPressGestureRecognizer pressRecognizer;

    public ViewController(IntPtr handle) : base(handle)
    {
    }

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();


        pressRecognizer = new UILongPressGestureRecognizer();
        pressRecognizer.AddTarget(() => HandleLongPress(pressRecognizer));

        var plotView = new PlotView
        {
            Model = CreatePlotModel(),
            Frame = this.View.Frame
        };
        plotView.UserInteractionEnabled = true;
        View.AddSubview(plotView);
        plotView.AddGestureRecognizer(pressRecognizer);

    }

    public override void DidReceiveMemoryWarning()
    {
        base.DidReceiveMemoryWarning();
        // Release any cached data, images, etc that aren't in use.     
    }

    private PlotModel CreatePlotModel()
    {

        var plotModel = new PlotModel { Title = "OxyPlot Demo" };

        plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
        plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Maximum = 10, Minimum = 0 });

        var series1 = new LineSeries
        {
            MarkerType = MarkerType.Circle,
            MarkerSize = 4,
            MarkerStroke = OxyColors.White
        };

        series1.Points.Add(new DataPoint(0.0, 6.0));
        series1.Points.Add(new DataPoint(1.4, 2.1));
        series1.Points.Add(new DataPoint(2.0, 4.2));
        series1.Points.Add(new DataPoint(3.3, 2.3));
        series1.Points.Add(new DataPoint(4.7, 7.4));
        series1.Points.Add(new DataPoint(6.0, 6.2));
        series1.Points.Add(new DataPoint(8.9, 8.9));

        plotModel.Series.Add(series1);

        return plotModel;
    }

    public void HandleLongPress(UILongPressGestureRecognizer longPress)
    {
        Console.WriteLine("LongPress triggered");
    }
 }
}
Comment 1 kongara.krishna.c 2017-07-20 15:32:09 UTC
Also, the UITapGestureRecognizer won't work. However, they work if the default PanZoomGestureRecognizer is removed from the PlotView but then the pan and zoom are disabled.
Comment 2 Alex Soto [MSFT] 2017-07-20 23:17:50 UTC
The broader developer community would be the best and quickest place for additional troubleshooting help on this issue.
Posting a question on OxyPlot issues [0], Stack Overflow [1] or the Xamarin Forums [2] would be the best next step.

[0] https://github.com/oxyplot/oxyplot/issues/
[1] http://stackoverflow.com/questions/tagged/xamarin
[2] https://forums.xamarin.com/

(Investigation by the Xamarin team in the bug tracker for an issue like this would usually require that the reporter includes additional background info to hint that Xamarin is behaving differently compared to Xcode.)

In case it might also be a helpful reference, you can find some general recommendations on the best places to ask various kinds of questions about Xamarin on:

https://developer.xamarin.com/guides/cross-platform/troubleshooting/support-options/