本文整理汇总了C#中UITableView.SetEditing方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.SetEditing方法的具体用法?C# UITableView.SetEditing怎么用?C# UITableView.SetEditing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.SetEditing方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
_table = new UITableView (new RectangleF (0, 44, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 44), UITableViewStyle.Plain);
this.View.AddSubview (_table);
_toolbar = new UIToolbar ();
_toolbar.BarStyle = UIBarStyle.Black;
_toolbar.Frame = new RectangleF (0, 0, UIScreen.MainScreen.Bounds.Width, 44);
this.View.AddSubview (_toolbar);
_editButton = new UIBarButtonItem ();
_editButton.Style = UIBarButtonItemStyle.Bordered;
_editButton.Title = "Edit";
_editButton.Clicked += delegate {
if (_table.Editing) {
_table.SetEditing (false, true);
_editButton.Title = "Edit";
} else {
_table.SetEditing (true, true);
_editButton.Title = "Done";
}
};
_closeButton = new UIBarButtonItem ();
_closeButton.Style = UIBarButtonItemStyle.Bordered;
_closeButton.Title = "Close";
_closeButton.Clicked += delegate {
SelectedSpeechItem = null;
this.DismissModalViewControllerAnimated (true);
};
_toolbar.Items = new UIBarButtonItem[] { _closeButton, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), _editButton };
}
示例2: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
table = new UITableView (new RectangleF (0, 64, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 44), UITableViewStyle.Plain);
View.AddSubview (table);
toolbar = new UIToolbar ();
toolbar.BarStyle = UIBarStyle.Default;
toolbar.Frame = new RectangleF (0, 20, UIScreen.MainScreen.Bounds.Width, 44);
View.AddSubview (toolbar);
editButton = new UIBarButtonItem ();
editButton.Style = UIBarButtonItemStyle.Bordered;
editButton.Title = "Edit";
editButton.Clicked += delegate {
if (table.Editing) {
table.SetEditing (false, true);
editButton.Title = "Edit";
} else {
table.SetEditing (true, true);
editButton.Title = "Done";
}
};
closeButton = new UIBarButtonItem ();
closeButton.Style = UIBarButtonItemStyle.Bordered;
closeButton.Title = "Close";
closeButton.Clicked += delegate {
SelectedSpeechItem = null;
DismissViewController (true, null);
};
toolbar.Items = new UIBarButtonItem[] { closeButton, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), editButton };
}
示例3: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
table = new UITableView(View.Bounds); // defaults to Plain style
table.AutoresizingMask = UIViewAutoresizing.All;
List<TableItem> tableItems = new List<TableItem>();
// credit for images and content
// http://en.wikipedia.org/wiki/List_of_culinary_vegetables
tableItems.Add (new TableItem("Vegetables") { SubHeading="65 items", ImageName="Vegetables.jpg"});
tableItems.Add (new TableItem("Fruits") { SubHeading="17 items", ImageName="Fruits.jpg"});
tableItems.Add (new TableItem("Flower Buds") { SubHeading="5 items", ImageName="Flower Buds.jpg"});
tableItems.Add (new TableItem("Legumes") { SubHeading="33 items", ImageName="Legumes.jpg"});
tableItems.Add (new TableItem("Bulbs") { SubHeading="18 items", ImageName="Bulbs.jpg"});
tableItems.Add (new TableItem("Tubers") { SubHeading="43 items", ImageName="Tubers.jpg"});
tableSource = new TableSource(tableItems, this);
table.Source = tableSource;
// To replace the standard edit button with a "Hi" button, uncomment out
// these lines
tableDelegate = new TableDelegate ();
table.Delegate = tableDelegate;
@add = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e)=>{
tableItems.Insert (0, new TableItem ("(inserted)") { SubHeading="0 items"}); // default new row
table.InsertRows (new NSIndexPath[] { NSIndexPath.FromRowSection(0,0) }, UITableViewRowAnimation.Fade);
});
done = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s,e)=>{
table.SetEditing (false, true);
NavigationItem.LeftBarButtonItem = @add;
NavigationItem.RightBarButtonItem = edit;
});
edit = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (s,e)=>{
if (table.Editing)
table.SetEditing (false, true); // if we've half-swiped a row
table.SetEditing (true, true);
NavigationItem.LeftBarButtonItem = null;
NavigationItem.RightBarButtonItem = done;
});
NavigationItem.RightBarButtonItem = edit;
NavigationItem.LeftBarButtonItem = @add;
Add (table);
}
示例4: EditActionsForRow
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath)
{
var item = feedClient.postings [indexPath.Row];
var saveListing = UITableViewRowAction.Create(UITableViewRowActionStyle.Normal, "Save", async delegate {
await AppDelegate.databaseConnection.AddNewListingAsync (item.PostTitle, item.Description, item.Link, item.ImageLink, item.Date);
//TODO: Make pattern image for background
tableView.EndEditing (true);
tableView.SetEditing (false, true);
Console.WriteLine (AppDelegate.databaseConnection.StatusMessage);
});
saveListing.BackgroundColor = ColorScheme.Carrot;
return new UITableViewRowAction[]{ saveListing };
}
示例5: ViewDidLoad
public override async void ViewDidLoad()
{
base.ViewDidLoad();
await RefreshView();
eventList = eventItemAdapter.getEventsByEmployeeID();
sortByDate(eventList);
table = new UITableView(View.Bounds); // defaults to Plain style
table.Source = new DeleteEventTableSource(eventList,this);
table.ContentInset = new UIEdgeInsets(65, 0, 0, 0);
Add(table);
table.SetEditing(true, true);
}
示例6: EditActionsForRow
public override UITableViewRowAction[] EditActionsForRow(UITableView tableView, NSIndexPath indexPath)
{
var item = categories[indexPath.Section].Items[indexPath.Row];
var exists = AppDelegate.databaseConnection.FavoriteCategoryAlreadyPresent(item.Key);
string title = exists ? "\u2605" : "\u2606";
var favorite = UITableViewRowAction.Create(UITableViewRowActionStyle.Default, title, async delegate {
tableView.SetEditing(false,true);
if (exists)
{
await AppDelegate.databaseConnection.DeleteFavoriteCategoryAsync(item.Key);
}
else
{
await AppDelegate.databaseConnection.AddNewFavoriteCategoryAsync(item.Key, item.Value);
}
Console.WriteLine (AppDelegate.databaseConnection.StatusMessage);
if (this.Favorited != null)
this.Favorited(this, new CategorySelectedEventArgs(){SelectedCat = item});
});
favorite.BackgroundColor = ColorScheme.Carrot;
return new UITableViewRowAction[]{ favorite };
}
示例7: InitializeComponent
void InitializeComponent()
{
// calculate the frame sizes
float navBarHeight = new UINavigationController().NavigationBar.Bounds.Height;
float tabBarHeight = new UITabBarController().TabBar.Bounds.Height;
float availableHeight = View.Bounds.Height - navBarHeight - tabBarHeight;
float toolbarHeight = navBarHeight;
float tableHeight = availableHeight - toolbarHeight;
// create the tableview
TableView = new UITableView() { Frame = new RectangleF(0, 0, View.Bounds.Width, tableHeight) };
TableView.BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground);
TableView.SeparatorColor = UIColorHelper.FromString(App.ViewModel.Theme.TableSeparatorBackground);
this.View.AddSubview(TableView);
// create the toolbar
Toolbar = new UIToolbar() { Frame = new RectangleF(0, tableHeight, View.Bounds.Width, toolbarHeight) };
var flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
//var addButton = new UIBarButtonItem("\u2795" /* big plus */ + "List", UIBarButtonItemStyle.Plain, delegate {
var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate {
FolderEditor folderEditor = new FolderEditor(this.NavigationController, null);
folderEditor.PushViewController();
});
var editButton = new UIBarButtonItem(UIBarButtonSystemItem.Edit);
var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);
editButton.Clicked += delegate
{
if (TableView.Editing == false)
{
TableView.SetEditing(true, true);
Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, doneButton, flexSpace }, false);
}
};
doneButton.Clicked += delegate
{
if (TableView.Editing == true)
{
TableView.SetEditing(false, true);
Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, editButton, flexSpace }, false);
// trigger a sync with the Service
App.ViewModel.SyncWithService();
}
};
Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, editButton, flexSpace }, false);
this.View.AddSubview(Toolbar);
}
示例8: InitializeComponent
void InitializeComponent()
{
// get the current list name
string listName = null;
if (listID == null || listID == Guid.Empty)
listName = Source.Folder.Name;
else
listName = Source.Folder.Items.Single(i => i.ID == listID).Name;
this.Title = listName;
// calculate the frame sizes
float navBarHeight =
parentController.NavigationController != null ?
parentController.NavigationController.NavigationBar.Bounds.Height :
new UINavigationController().NavigationBar.Bounds.Height;
float tabBarHeight =
parentController.TabBarController.TabBar != null ?
parentController.TabBarController.TabBar.Bounds.Height :
new UINavigationController().NavigationBar.Bounds.Height;
float availableHeight = View.Bounds.Height - navBarHeight - tabBarHeight;
float toolbarHeight = navBarHeight;
float tableHeight = availableHeight - toolbarHeight;
// create the tableview
TableView = new UITableView() { Frame = new RectangleF(0, 0, View.Bounds.Width, tableHeight) };
TableView.BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground);
TableView.SeparatorColor = UIColorHelper.FromString(App.ViewModel.Theme.TableSeparatorBackground);
this.View.AddSubview(TableView);
// create the toolbar - edit button, add button, sort button
Toolbar = new UIToolbar() { Frame = new RectangleF(0, tableHeight, View.Bounds.Width, toolbarHeight) };
var flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
// create the add button
var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate { AddButton_Click(); });
// create the email button
var emailButton = CreateEmailButton();
// create the sort button along with the action, which will instantiate a new DialogViewController
var sortButton = CreateSortButton();
// create the edit and done buttons
// the edit button puts the table in edit mode, and the done button returns to normal mode
if (editButtonImage == null)
editButtonImage = UIImageCache.GetUIImage("Images/187-pencil.png");
var editButton = new UIBarButtonItem(editButtonImage, UIBarButtonItemStyle.Plain, null);
var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);
editButton.Clicked += delegate
{
if (TableView.Editing == false)
{
TableView.SetEditing(true, true);
Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, sortButton, flexSpace, emailButton, flexSpace, doneButton, flexSpace }, false);
}
};
doneButton.Clicked += delegate
{
if (TableView.Editing == true)
{
TableView.SetEditing(false, true);
Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, sortButton, flexSpace, emailButton, flexSpace, editButton, flexSpace }, false);
// trigger a sync with the Service
App.ViewModel.SyncWithService();
Source.Folder = App.ViewModel.LoadFolder(Source.Folder.ID);
}
};
// create the toolbar with all its buttons
Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, sortButton, flexSpace, emailButton, flexSpace, editButton, flexSpace }, false);
this.View.AddSubview(Toolbar);
// create the properties right bar button item
this.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Properties", UIBarButtonItemStyle.Bordered, delegate {
if (listID == null || listID == Guid.Empty)
{
FolderEditor folderEditor = new FolderEditor(this.NavigationController, Source.Folder);
folderEditor.PushViewController();
}
else
{
ListEditor listEditor = new ListEditor(this.NavigationController, Source.Folder, Source.List, null);
listEditor.PushViewController();
}
});
}