예제 #1
0
 public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
 {
     Console.WriteLine("Editing Style : " + editingStyle.ToString());
     if (editingStyle == UITableViewCellEditingStyle.Delete)
     {
         items.RemoveAt(indexPath.Row);  //在数据源中删除要删除的数据
         tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Automatic);
     }
     else if (editingStyle == UITableViewCellEditingStyle.Insert)
     {
         string s = string.Format("Inserted item : {0}", items.Count + 1);
         items.Insert(indexPath.Row, s);
         tableView.InsertRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Automatic);
     }
 }