public override async void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index) { //make sure the first button is tapped. We only have one, but you never know if (index == 0) { var filePath = ((PicturePreviewCell)cell).FilePath; //validate that the filePath isn't empty if (!string.IsNullOrEmpty(filePath)) { //confirm via UIAlert to delete var isDelete = await Helper.Utility.ShowAlert(_lookupService.GetLocalizedString("Confirm"), _lookupService.GetLocalizedString("DeleteFileMessage"), _lookupService.GetLocalizedString("Delete"), _lookupService.GetLocalizedString("Cancel")); if (isDelete) { //delete the file and reload the table _fileHelper.Delete(filePath); _controller.Files.Remove(filePath); //reload the table data without the file in it _tableView.ReloadData(); } else { cell.HideUtilityButtons(true); } } } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { if (useCustomCells) { UMTableViewCell cell = (UMTableViewCell)tableView.DequeueReusableCell("UMCell"); // we assume that only new cells have no delegate if (cell.Delegate == null) { cell.Delegate = cellDelegate; // optionally specify a width that each set of utility buttons will share cell.SetLeftUtilityButtons(LeftButtons(), 32.0f); cell.SetRightUtilityButtons(RightButtons(), 58.0f); } cell.Label.Text = string.Format("Section: {0}, Seat: {1}", indexPath.Section, indexPath.Row); return(cell); } else { SWTableViewCell cell = (SWTableViewCell)tableView.DequeueReusableCell("Cell"); // we assume that only new cells have no delegate if (cell.Delegate == null) { cell.Delegate = cellDelegate; cell.RightUtilityButtons = RightButtons(); cell.LeftUtilityButtons = LeftButtons(); } cell.TextLabel.Text = string.Format("Seat: {0}", testArray [indexPath.Section] [indexPath.Row]); cell.DetailTextLabel.Text = string.Format("Details for seat {1} in section: {0}.", indexPath.Section, indexPath.Row); return(cell); } }
public override void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index) { NSIndexPath cellIndexPath = tableView.IndexPathForCell(cell); switch (index) { case 0: // More button was pressed cell.HideUtilityButtons(true); var editVc = ParentView.Storyboard.InstantiateViewController("CreateEditNewsViewController") as CreateEditNewsViewController; if (editVc == null) { return; } var createEditNavigationController = new UINavigationController(editVc); editVc.News = _datalist[cellIndexPath.Row]; ParentView.NavigationController.PresentViewController(createEditNavigationController, true, null); break; case 1: // Delete button was pressed _datalist.RemoveAt(cellIndexPath.Row); tableView.DeleteRows(new[] { cellIndexPath }, UITableViewRowAnimation.Left); break; } }
public override bool CanSwipeToState(SWTableViewCell cell, SWCellState state) { switch (state) { case SWCellState.Left: // set to false to disable all left utility buttons appearing return(false); case SWCellState.Right: // set to false to disable all right utility buttons appearing return(true); } return(true); }
public override void ScrollingToState(SWTableViewCell cell, SWCellState state) { switch (state) { case SWCellState.Center: Console.WriteLine("utility buttons closed"); break; case SWCellState.Left: Console.WriteLine("left utility buttons open"); break; case SWCellState.Right: Console.WriteLine("right utility buttons open"); break; } }
public override void ScrollingToState(SWTableViewCell cell, SWCellState state) { switch (state) { case SWCellState.Center: Console.WriteLine("utility buttons closed"); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; break; case SWCellState.Left: Console.WriteLine("left utility buttons open"); break; case SWCellState.Right: Console.WriteLine("right utility buttons open"); cell.Accessory = UITableViewCellAccessory.None; break; } }
public override void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index) { Console.WriteLine("Right button {0} was pressed.", index); switch (index) { case 0: // More button was pressed Console.WriteLine("More button was pressed"); new UIAlertView("Hello", "More more more", null, "cancel", null).Show(); cell.HideUtilityButtons(true); break; case 1: // Delete button was pressed NSIndexPath cellIndexPath = tableView.IndexPathForCell(cell); testArray [cellIndexPath.Section].RemoveAt(cellIndexPath.Row); tableView.DeleteRows(new[] { cellIndexPath }, UITableViewRowAnimation.Left); break; } }
public override bool ShouldHideUtilityButtonsOnSwipe(SWTableViewCell cell) { return(true); }
public override bool ShouldHideUtilityButtonsOnSwipe(SWTableViewCell cell) { // allow just one cell's utility button to be open at once return(true); }
public override void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index) { _baseSwipeableProductCell.RightSwipeButtons[(int)index].Clicked.Invoke(); cell.HideUtilityButtons(true); }
public override void DidTriggerLeftUtilityButton(SWTableViewCell cell, nint index) { Console.WriteLine("Left button {0} was pressed.", index); new UIAlertView("Left Utility Buttons", string.Format("Left button {0} was pressed.", index), null, "OK", null).Show(); }
public override void DidTriggerRightUtilityButton(SWTableViewCell cell, nint index) { NSIndexPath cellIndexPath = _tableView.IndexPathForCell(cell); _deleteAction(cellIndexPath); }
public override void DidTriggerLeftUtilityButton(SWTableViewCell cell, nint index) { }