コード例 #1
0
        public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewRowAction deleteRowAction = UITableViewRowAction.Create(UITableViewRowActionStyle.Destructive, "Delete", (UITableViewRowAction rowAction, NSIndexPath actionIndexPath) =>
            {
                arExperienceGroup.ArExperiences.RemoveAt(actionIndexPath.Row);
                tableView.DeleteRows(new NSIndexPath[] { actionIndexPath }, UITableViewRowAnimation.Right);
                ArExperienceManager.WriteToFile(persitentArExperienceGroupFilePath, arExperienceGroup);
            });

            UITableViewRowAction editRowAction = UITableViewRowAction.Create(UITableViewRowActionStyle.Default, "Edit", (UITableViewRowAction rowAction, NSIndexPath actionIndexPath) =>
            {
                PerformSegue("add_url_view_controller_segue", actionIndexPath);
            });

            editRowAction.BackgroundColor = UIColor.FromRGB(0.060f, 0.502f, 0.998f);

            return(new UITableViewRowAction [] { deleteRowAction, editRowAction });
        }
コード例 #2
0
        public void ComeBackFromAddURLViewController(UIStoryboardSegue segue)
        {
            if (segue.SourceViewController.GetType() == typeof(AddURLViewController))
            {
                AddURLViewController addURLViewController = (AddURLViewController)segue.SourceViewController;
                if (addURLViewController.GetState() == AddURLViewController.State.Created)
                {
                    ArExperience arExperience = addURLViewController.CreatedArExperience();
                    arExperienceGroup.ArExperiences.Insert(0, arExperience);

                    TableView.InsertRows(new NSIndexPath[] { NSIndexPath.Create(new int[] { 0, 0 }) }, UITableViewRowAnimation.Top);
                }
                else if (addURLViewController.GetState() == AddURLViewController.State.Edited)
                {
                    ArExperience updatedArExperience = addURLViewController.UpdatedArExperience();
                    int          index = arExperienceGroup.ArExperiences.FindIndex(x => x == updatedArExperience);
                    arExperienceGroup.ArExperiences[index] = addURLViewController.CreatedArExperience();
                    TableView.ReloadRows(new NSIndexPath[] { NSIndexPath.Create(new int[] { 0, index }) }, UITableViewRowAnimation.Automatic);
                }
                ArExperienceManager.WriteToFile(persitentArExperienceGroupFilePath, arExperienceGroup);
            }
        }