bool OnShouldReceiveTouch(UIGestureRecognizer r, UITouch t) { var scrollPos = t.LocationInView(_scrollView); var rect = new RectangleF(0, 0, _scrollView.ContentSize.Width, _scrollView.ContentSize.Height); return(!rect.Contains(scrollPos)); }
/// <summary> /// Indexs the path at point. /// </summary> /// <returns>The path at point.</returns> /// <param name="listView">List view.</param> /// <param name="p">P.</param> public Tuple <int, int> IndexPathAtPoint(Xamarin.Forms.ListView listView, Xamarin.Forms.Point p) { var renderer = Renderer(listView); var point = new CoreGraphics.CGPoint(p.X * Display.Scale, p.Y * Display.Scale); //System.Diagnostics.Debug.WriteLine("size=["+renderer.Control.Frame.Size+"]"); //System.Diagnostics.Debug.WriteLine("point=["+point+"]"); var visibleCells = renderer.Control.VisibleCells; var visibleCellIndexPaths = renderer.Control.IndexPathsForVisibleRows; var scroll = renderer.Control.ContentOffset; //System.Diagnostics.Debug.WriteLine("Scroll=["+scroll+"]"); foreach (var ip in visibleCellIndexPaths) { var cell = renderer.Control.CellAt(ip); var frame = cell.Frame; var frameX = cell.ConvertRectToView(frame, renderer.Control); var frameZ = new CoreGraphics.CGRect(frameX.X - scroll.X * Display.Scale, frameX.Y - scroll.Y * Display.Scale, frameX.Width * Display.Scale, frameX.Height * Display.Scale); //System.Diagnostics.Debug.WriteLine("ip=["+ip+"] frame=[" + frameZ + "]"); if (frameZ.Contains(point)) { return(new Tuple <int, int>(ip.Section, ip.Row)); } } return(null); //System.Diagnostics.Debug.WriteLine(""); //var indexPath = renderer.Control.IndexPathForRowAtPoint(point); //return new Tuple<int, int>(indexPath.Section, indexPath.Row); }
void CellTapped(UITapGestureRecognizer tapRecognizer) { CoreGraphics.CGPoint point = tapRecognizer.LocationInView(this); var totalWidth = Columns * 75 + (Columns - 1) * 4; var startX = (Bounds.Size.Width - totalWidth) / 2; var frame = new CoreGraphics.CGRect(startX, 2, 75, 75); for (int i = 0; i < RowAssets.Count; ++i) { if (frame.Contains(point)) { ELCAsset asset = RowAssets [i]; asset.Selected = !asset.Selected; var overlayView = OverlayViewArray [i]; overlayView.Hidden = !asset.Selected; break; } var x = frame.X + frame.Width + 4; frame = new CoreGraphics.CGRect(x, frame.Y, frame.Width, frame.Height); } }
bool OnShouldReceiveTouch(UIGestureRecognizer r, UITouch t) { var scrollPos = t.LocationInView(_scrollView); var rect = new RectangleF(0, 0, _scrollView.ContentSize.Width, _scrollView.ContentSize.Height); return !rect.Contains(scrollPos); }