本文整理汇总了C#中UITableView.NumberOfRowsInSection方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.NumberOfRowsInSection方法的具体用法?C# UITableView.NumberOfRowsInSection怎么用?C# UITableView.NumberOfRowsInSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.NumberOfRowsInSection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomizeMoveTarget
public override NSIndexPath CustomizeMoveTarget(UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath proposedIndexPath)
{
var numRows = tableView.NumberOfRowsInSection (0) - 1; // less the (add new) one
if (proposedIndexPath.Row >= numRows)
return NSIndexPath.FromRowSection(numRows - 1, 0);
else
return proposedIndexPath;
}
示例2: CalculateSelectedRow
private int CalculateSelectedRow (NSIndexPath indexPath, UITableView tableView)
{
int totalCountOfRows = 0;
int selectedSectionNumber = indexPath.Section;
for (int currentSectionNumber = 0; currentSectionNumber < selectedSectionNumber; ++ currentSectionNumber) {
totalCountOfRows += tableView.NumberOfRowsInSection (currentSectionNumber);
}
int selectedRow = totalCountOfRows + indexPath.Row;
return selectedRow;
}
示例3: CommitEditingStyle
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath)
{
//base.CommitEditingStyle(tableView, editingStyle, indexPath);
if (editingStyle == UITableViewCellEditingStyle.Delete) {
UITableViewCell cell = tableView.CellAt(indexPath);
if (cell != null)
cell.BackgroundColor = UIColor.White;
BNRItem itemToRemove = BNRItemStore.allItems[indexPath.Row];
BNRItemStore.RemoveItem(itemToRemove);
NSIndexPath[] indexPaths = new NSIndexPath[] {indexPath};
TableView.DeleteRows(indexPaths, UITableViewRowAnimation.Automatic);
Console.WriteLine("allItems: {0}, tableViewRows: {1}", BNRItemStore.allItems.Count, tableView.NumberOfRowsInSection(0));
}
}
示例4: CanEditRow
public override bool CanEditRow (UITableView tableView, NSIndexPath indexPath)
{
/*
var cell = base.GetCell(tableView, indexPath);
var reuse = cell.ReuseIdentifier;
if (reuse == "LoadMoreElement")
return true;
*/
int rows = tableView.NumberOfRowsInSection(0);
if (rows - 1 == indexPath.Row)
return false;
// Trivial implementation: we let all rows be editable, regardless of section or row
return true;
}
示例5: DidFinishTableEditing
public void DidFinishTableEditing(UITableView tableView)
{
tableView.BeginUpdates ();
// remove our 'ADD NEW' row from the underlying data
tableItems.RemoveAt (tableView.NumberOfRowsInSection (0) - 1); // zero based :)
// remove the row from the table display
tableView.DeleteRows (new NSIndexPath[] { NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0) - 1, 0) }, UITableViewRowAnimation.Fade);
tableView.EndUpdates (); // applies the changes
}
示例6: CanMoveRow
public override bool CanMoveRow(UITableView tableView, NSIndexPath indexPath)
{
return indexPath.Row < tableView.NumberOfRowsInSection (0) - 1;
}
示例7: WillBeginTableEditing
public void WillBeginTableEditing(UITableView tableView)
{
tableView.BeginUpdates ();
// insert the 'ADD NEW' row at the end of table display
tableView.InsertRows (new NSIndexPath[] {
NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0), 0)
}, UITableViewRowAnimation.Fade);
// create a new item and add it to our underlying data (it is not intended to be permanent)
Item o = new Item ();
o.Name = "(add new)";
// o.imageFileNames = new List<string> ();
o.ImageFileName = "first.png";
tableItems.Add (o);
tableView.EndUpdates (); // applies the changes
}
示例8: EditingStyleForRow
public override UITableViewCellEditingStyle EditingStyleForRow(UITableView tableView, NSIndexPath indexPath)
{
if (tableView.Editing) {
if (indexPath.Row == tableView.NumberOfRowsInSection (0) - 1)
return UITableViewCellEditingStyle.Insert;
else
return UITableViewCellEditingStyle.Delete;
} else // not in editing mode, enable swipe-to-delete for all rows
return UITableViewCellEditingStyle.Delete;
}
示例9: WillBeginTableEditing
/// <summary>
/// Called manually when the table goes into edit mode
/// </summary>
public void WillBeginTableEditing (UITableView tableView)
{
//---- start animations
tableView.BeginUpdates ();
//---- insert a new row in the table
tableView.InsertRows (new NSIndexPath[] {
NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0), 0)
}, UITableViewRowAnimation.Fade);
//---- create a new item and add it to our underlying data
tableItems.Add (new TableItem ("(add new)"));
//---- end animations
tableView.EndUpdates ();
}
示例10: DeleteComment
public static void DeleteComment(Post post, Comment comment, UITableView tableView, NSIndexPath indexPath, List<Comment> underlyingDataSource)
{
post.liked = true;
CATransaction.Begin();
tableView.BeginUpdates();
CATransaction.CompletionBlock += async delegate
{
try
{
bool result = await TenServices.DeleteComment(comment, post);
if (!result)
{
underlyingDataSource.Insert(indexPath.Row, comment);
tableView.ReloadData();
}
return;
}
catch (RESTError)
{
Console.WriteLine("Error service helper");
}
return;
};
if (tableView.NumberOfRowsInSection(indexPath.Section) == 1)
{
tableView.DeleteSections(NSIndexSet.FromIndex(indexPath.Section), UITableViewRowAnimation.Left);
}
else {
tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Left);
}
underlyingDataSource.Remove(comment);
tableView.EndUpdates();
CATransaction.Commit();
}
示例11: DidFinishTableEditingWithoutSave
public void DidFinishTableEditingWithoutSave (UITableView tableView)
{
tableView.BeginUpdates ();
_tableItems.RemoveAt ((int)tableView.NumberOfRowsInSection (0) - 2);
tableView.DeleteRows (new NSIndexPath[] { NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0) - 2, 0) }, UITableViewRowAnimation.Fade);
tableView.EndUpdates ();
}
示例12: WillBeginTableEditing
public void WillBeginTableEditing (UITableView tableView)
{
tableView.BeginUpdates ();
tableView.InsertRows (new NSIndexPath[] {
NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0), 0)
}, UITableViewRowAnimation.Fade);
_tableItems.Add (null);
tableView.EndUpdates ();
}
示例13: EditingStyleForRow
public override UITableViewCellEditingStyle EditingStyleForRow (UITableView tableView, NSIndexPath indexPath)
{
if (tableView.Editing) {
if (indexPath.Row == tableView.NumberOfRowsInSection (0) - 1) {
return UITableViewCellEditingStyle.Insert;
} else {
return UITableViewCellEditingStyle.Delete;
}
} else {
return UITableViewCellEditingStyle.Delete;
}
}
示例14: DidFinishTableEditing
/// <summary>
/// Called manually when the table leaves edit mode
/// </summary>
public void DidFinishTableEditing (UITableView tableView)
{
//---- start animations
tableView.BeginUpdates ();
//---- remove our row from the underlying data
tableItems.RemoveAt ((int)tableView.NumberOfRowsInSection (0) - 1); // zero based :)
//---- remove the row from the table
tableView.DeleteRows (new NSIndexPath[] { NSIndexPath.FromRowSection (tableView.NumberOfRowsInSection (0) - 1, 0) }, UITableViewRowAnimation.Fade);
//---- finish animations
tableView.EndUpdates ();
}
示例15: WillBeginTableEditing
/// <summary>
/// Called manually when the table goes into edit mode
/// </summary>
public void WillBeginTableEditing(UITableView tableView)
{
//---- start animations
tableView.BeginUpdates();
//---- insert a new row in the table
tableView.InsertRows(new NSIndexPath[] { NSIndexPath.FromRowSection(tableView.NumberOfRowsInSection(0), 0) }, UITableViewRowAnimation.Fade);
//---- end animations
tableView.EndUpdates();
}