// Removes a home from the List and updates the view. protected override void DidRemoveHome(HMHome home) { var index = Homes.IndexOf(home); if (index < 0) { return; } var indexPath = NSIndexPath.FromRowSection(index, (int)HomeListSection.Homes); Homes.RemoveAt(index); var primaryIndexPath = NSIndexPath.FromRowSection(index, (int)HomeListSection.PrimaryHome); // If there aren't any homes, we still want one cell to display 'No Homes'. // Just reload. TableView.BeginUpdates(); if (Homes.Count == 0) { TableView.ReloadRows(new [] { primaryIndexPath }, UITableViewRowAnimation.Fade); } else { TableView.DeleteRows(new [] { primaryIndexPath }, UITableViewRowAnimation.Automatic); } TableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Automatic); TableView.EndUpdates(); }
protected virtual void DidRemoveHome(HMHome home) { var removedHomeIndex = Homes.IndexOf(home); if (removedHomeIndex < 0) { return; } Homes.RemoveAt(removedHomeIndex); var indexPath = NSIndexPath.FromRowSection(removedHomeIndex, 0); TableView.DeleteRows(new [] { indexPath }, UITableViewRowAnimation.Automatic); }