Nisar Ahmad
Nisar Ahmad

Reputation: 2067

How to Check view is visible in UIScrollview in Xamarin.ios?

My code

CGRect viewRect = tableAnswerSheet.Frame;
            CGRect mainRect = sv.Frame;

            if(CGRectIntersectsRect(mainRect, viewRect))
            {
                //view is visible
            }else{

            }//view is visible

But getting this error.

The name `CGRectIntersectsRect' does not exist in the current context

Using

using CoreGraphics;

what is alternative class of CGRectIntersectsRect in Xamarin.ios

Thanks in advance

Upvotes: 0

Views: 398

Answers (1)

Fahad Rehman
Fahad Rehman

Reputation: 1199

It is CoreGraphics.CGRect.Intersects https://developer.xamarin.com/api/member/CoreGraphics.CGRect.IntersectsWith/p/CoreGraphics.CGRect/

CGRect viewRect = tableAnswerSheet.Frame;
CGRect mainRect = sv.Frame;

if (viewRect.IntersectsWith(viewRect))
{
    //view is visible
}
else {
      //view is visible
}

Upvotes: 1

Related Questions