private void AddSwipeGestures(ViewCell cell, UITableViewCell tableViewCell, UITableView tableView)
        {
            swipeRight = new UISwipeGestureRecognizer(() =>
            {
                if (!(cell as CustomViewCell).Checked)
                {
                    UIView.Animate(0.2, 0.0, UIViewAnimationOptions.TransitionNone,
                                   () =>
                    {
                        tableViewCell.Frame = new RectangleF(
                            new PointF((float)(tableViewCell.Frame.Location.X + 26),
                                       (float)tableViewCell.Frame.Location.Y),
                            (SizeF)tableViewCell.Frame.Size);
                    },
                                   () =>
                    {
                        tableViewCell.Frame = new RectangleF(
                            new PointF((float)(tableViewCell.Frame.Location.X - 26),
                                       (float)tableViewCell.Frame.Location.Y),
                            (SizeF)tableViewCell.Frame.Size);
                        (cell as CustomViewCell).Checked = true;
                    });
                }
            });

            swipeRight.Direction = UISwipeGestureRecognizerDirection.Right;
            swipeLeft            = new UISwipeGestureRecognizer(() => (cell as CustomViewCell).Checked = false)
            {
                Direction = UISwipeGestureRecognizerDirection.Left, Delegate = new SwipeRecogniserDelegate(cell as CustomViewCell)
            };

            tableViewCell.AddGestureRecognizer(swipeRight);
            tableViewCell.AddGestureRecognizer(swipeLeft);
        }
示例#2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell(cellID);
            var item = values[0].PickerWheelOptions[indexPath.Row];
            UITapGestureRecognizer tap;

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, cellID);
                tap  = new UITapGestureRecognizer(delegate(UITapGestureRecognizer obj) {
                    if (cell.Accessory == UITableViewCellAccessory.None)
                    {
                        cell.Accessory = UITableViewCellAccessory.Checkmark;
                    }
                    else
                    {
                        cell.Accessory = UITableViewCellAccessory.None;
                    }
                    if (this.ValueChanged != null)
                    {
                        this.ValueChanged(this, new PickerChangedEventArgs()
                        {
                            SelectedKey = item.Key, SelectedValue = item.Value
                        });
                    }
                });
                tap.ShouldRecognizeSimultaneously = (d1, d2) => true;
                cell.AddGestureRecognizer(tap);
            }
            cell.TextLabel.Text  = item.Key.ToString();
            cell.BackgroundColor = ColorScheme.Clouds;

            return(cell);
        }
 private void AddGestures(ViewCell cell, UITableViewCell tableViewCell, UITableView tableView)
 {
     if (VisitActionDetailsPage.CurrentInstance.IsEditable)
     {
         if (VisitActionDetailsPage.CurrentInstance.SingleTypeCode != null)
         {
             tableViewCell.AddGestureRecognizer(LongPressGestureRecognizer.CreateGesture(tableView, cell));
         }
     }
     else
     {
         tableViewCell.RemoveGestureRecognizer(LongPressGestureRecognizer.CreateGesture(tableView, cell));
     }
 }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = tableView.DequeueReusableCell(cellID);
            var item = values[0].PickerWheelOptions[indexPath.Row];
            UITapGestureRecognizer tap;
            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, cellID);
                tap = new UITapGestureRecognizer( delegate(UITapGestureRecognizer obj) {
                    if (cell.Accessory == UITableViewCellAccessory.None)
                        cell.Accessory = UITableViewCellAccessory.Checkmark;
                    else
                        cell.Accessory = UITableViewCellAccessory.None;
                    if (this.ValueChanged != null)
                        this.ValueChanged(this, new PickerChangedEventArgs(){SelectedKey = item.Key, SelectedValue = item.Value});
                });
                tap.ShouldRecognizeSimultaneously = (d1, d2) => true;
                cell.AddGestureRecognizer(tap);
            }
            cell.TextLabel.Text = item.Key.ToString();
            cell.BackgroundColor = ColorScheme.Clouds;

            return cell;
        }
示例#5
0
 private void AddGestures(ViewCell cell, UITableViewCell tableViewCell, UITableView tableView)
 {
     tableViewCell.AddGestureRecognizer(LongPressGestureRecognizer.CreateGesture(tableView, cell));
 }
示例#6
0
 private void AddGestures(ViewCell cell, UITableViewCell tableViewCell, UITableView tableView)
 {
     tableViewCell.AddGestureRecognizer(LongPressGestureRecognizer.CreateGesture(tableView, cell));
 }