Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从UITableView中删除节。NSIndexSet参数?_C#_Ios_Uitableview_Xamarin - Fatal编程技术网

C# 从UITableView中删除节。NSIndexSet参数?

C# 从UITableView中删除节。NSIndexSet参数?,c#,ios,uitableview,xamarin,C#,Ios,Uitableview,Xamarin,在验证表中没有更多行之后,我试图删除该表中的一个节,但我不确定NSIndexSet参数应该传递给它什么。下面是我正在使用的代码片段: public override void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { if (editingStyle == UITableViewC

在验证表中没有更多行之后,我试图删除该表中的一个节,但我不确定NSIndexSet参数应该传递给它什么。下面是我正在使用的代码片段:

        public override void CommitEditingStyle (UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
    {
        if (editingStyle == UITableViewCellEditingStyle.Delete) {
            BreakawayDB.UpdateUserTeam (_indexedTableItems[_keys[indexPath.Section]][indexPath.Row].TeamID, false);
            _indexedTableItems[_keys[indexPath.Section]].RemoveAt (indexPath.Row);

            tableView.DeleteRows (new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);

            if(_indexedTableItems[_keys[indexPath.Section]].Count == 0){
                tableView.DeleteSections( new NSIndexSet[] { ????? }, UITableViewRowAnimation.Fade);
            }
        }
    }
有什么建议吗?

试试这个:

tableView.DeleteSections( NSIndexSet.FromIndex (indexPath.Section), UITableViewRowAnimation.Fade);

你看过报纸了吗?很清楚索引集中应该包含什么。你对NSIndexSet有什么特别的问题吗?是的,NSIndexSet.FromIndex正是我想要的…谢谢!