Forum Cross Platform with Xamarin

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Scrolling not smooth with ScrollView control in IOS mobile devices

I have been using SkiaSharp for a few maonth now and having great success on showing my drawing instructions on Android & IOS device. I am using SKCanvasView control which I am placing it inside ScrollView control. On scroll of ScrollView translating SKCanvasView to ScrollTop and ScrollLeft position so that SKCanvasView should intact with Visible region of ScrollView Control.

This is all working smoothly in Android. But in IOS device, scrolling is not smooth. Scrolling is holding by UI thread and it si not smooth. PLease have a look at the code and please suggest if you have any suggestions.

    private void View_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
    {
        SKRect rect = paginatedViewProvider.GetViewPortRect();

        // I have lots of image tiles which I am drawing on skbitmap and returning it. This is taking around 10ms
        SKBitmap pageBitmap = GenerateSKBitmapFromIntenseCalculation();

        float Top = (float)(rect.Top - scrollTop);
        float Left = (float)(rect.Left - scrollLeft);

        e.Surface.Canvas.DrawBitmap(pageBitmap, SKRect.Create(Left, Top, rect.Width, rect.Height));
    }

    private bool OnTimerTick()
    {
        viewPanel.InvalidateSurface();
        return true;
    }
Sign In or Register to comment.