本文整理汇总了C#中UITableView.EndUpdates方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.EndUpdates方法的具体用法?C# UITableView.EndUpdates怎么用?C# UITableView.EndUpdates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.EndUpdates方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareEntry
protected virtual void PrepareEntry(UITableView tableview){
var topspace = string.IsNullOrEmpty(_element.Caption)? 0 : 20;
_entry = new UITextView(new RectangleF(0,topspace,Frame.Width, Frame.Height-topspace));
TextLabel.BackgroundColor = UIColor.Clear;
TextLabel.TextColor = UIColor.Gray;
TextLabel.Font = UIFont.SystemFontOfSize(14);
_entry.AutoresizingMask = UIViewAutoresizing.FlexibleWidth |
UIViewAutoresizing.FlexibleLeftMargin;
_entry.Editable = true;
_entry.Font = Font;
_entry.ScrollEnabled = false;
_entry.Bounces = false;
_entry.ContentMode = UIViewContentMode.TopLeft;
_entry.EnablesReturnKeyAutomatically = true;
_entry.Changed += delegate {
if (_element != null)
_element.Value = _entry.Text;
tableview.BeginUpdates();
_entry.Frame = new RectangleF(0,topspace,Frame.Width, Frame.Height-topspace);
tableview.EndUpdates();
};
_entry.Ended += delegate {
if (_element != null)
_element.Value = _entry.Text;
tableview.BeginUpdates();
tableview.EndUpdates();
_entry.Frame = new RectangleF(0,topspace,Frame.Width, Frame.Height-topspace);
};
_entry.Started += delegate {
EntryElement self = null;
var returnType = UIReturnKeyType.Default;
foreach (var e in (_element.Parent as Section).Elements){
if (e == _element)
self = _element;
else if (self != null && e is EntryElement)
returnType = UIReturnKeyType.Next;
}
_entry.ReturnKeyType = returnType;
};
ContentView.AddSubview (_entry);
ContentView.BringSubviewToFront(TextLabel);
}
示例2: OnChange
private void OnChange(UITableView table, NSIndexPath ip)
{
var cell = table.CellAt (ip) as Cell;
var size = cell.TextView.Bounds.Size;
var newSize = cell.TextView.SizeThatFits (new CGSize (size.Width, nfloat.MaxValue));
if (size.Height != newSize.Height) {
UIView.AnimationsEnabled = false;
table.BeginUpdates ();
table.EndUpdates ();
UIView.AnimationsEnabled = true;
table.ScrollToRow (ip, UITableViewScrollPosition.Top, false);
}
Items [ip.Row] = cell.TextView.Text;
}
示例3: Update
public void Update(MultilineEntryElement element, UITableView tableView){
_element = element;
if (_entry==null){
PrepareEntry(tableView);
}
_entry.Text = element.Value ?? "";
_entry.SecureTextEntry = element.IsPassword;
_entry.AutocapitalizationType = element.AutoCapitalize;
_entry.KeyboardType = element.KeyboardType;
TextLabel.Text = element.Caption;
tableView.BeginUpdates();
tableView.EndUpdates();
}
示例4: GetCell
public override UITableViewCell GetCell(UITableView tv)
{
var cell = tv.DequeueReusableCell(CustomInputCell.Key) as CustomInputCell;
if (cell == null)
{
cell = new CustomInputCell(_description);
cell.SelectionStyle = UITableViewCellSelectionStyle.None;
cell.TextView.Font = Font;
cell.TextView.InputAccessoryView = AccessoryView != null ? AccessoryView(cell.TextView) : new UIView();
cell.TextView.AutocorrectionType = SpellChecking ? UITextAutocorrectionType.Default : UITextAutocorrectionType.No;
cell.TextView.SpellCheckingType = SpellChecking ? UITextSpellCheckingType.Default : UITextSpellCheckingType.No;
cell.TextView.AutocapitalizationType = SpellChecking ? UITextAutocapitalizationType.Sentences : UITextAutocapitalizationType.None;
}
cell.HiddenSeperator = HiddenSeperator;
if (_textEditEnded != null)
_textEditEnded.Dispose();
_textEditEnded = Observable.FromEventPattern(x => cell.TextView.Ended += x, x => cell.TextView.Ended -= x)
.Subscribe(x => Value = cell.TextView.Text);
if (_textEditChanged != null)
_textEditChanged.Dispose();
_textEditChanged = Observable.FromEventPattern(x => cell.TextView.Changed += x, x => cell.TextView.Changed -= x)
.Subscribe(x =>
{
Value = cell.TextView.Text;
tv.BeginUpdates();
tv.EndUpdates();
var caret = cell.TextView.GetCaretRectForPosition(cell.TextView.SelectedTextRange.Start);
var cursorRect = tv.ConvertRectFromView(caret, cell.TextView);
var kk = cursorRect.Size;
kk.Height += 8.0f;
cursorRect.Size = kk;
tv.ScrollRectToVisible(cursorRect, false);
});
cell.TextView.Text = Value ?? string.Empty;
return cell;
}
示例5: RowSelected
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
lastindexPath = indexPath;
if (isChild(indexPath)) {
//Handle selection of child cell
Console.WriteLine("You touched a child!");
tableView.DeselectRow(indexPath, true);
return;
}
tableView.BeginUpdates();
if (currentExpandedIndex == indexPath.Row) {
this.collapseSubItemsAtIndex(tableView, currentExpandedIndex);
currentExpandedIndex = -1;
} else {
var shouldCollapse = currentExpandedIndex > -1;
if (shouldCollapse) {
this.collapseSubItemsAtIndex(tableView, currentExpandedIndex);
}
currentExpandedIndex = (shouldCollapse && indexPath.Row > currentExpandedIndex) ? indexPath.Row - 1 : indexPath.Row;
this.expandItemAtIndex(tableView, currentExpandedIndex);
}
tableView.EndUpdates();
tableView.DeselectRow (indexPath, false);
}
示例6: 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[1].Items.RemoveAt (1);
//---- remove the row from the table
tableView.DeleteRows (new NSIndexPath[] { NSIndexPath.FromRowSection (1, 1) }, UITableViewRowAnimation.Fade);
//---- finish animations
tableView.EndUpdates ();
}
示例7: GetCell
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
var cell = MainTwitterTimelne.DequeueReusableCell("twitcell");
if (cell == null)
{
cell = new UITableViewCell(UITableViewCellStyle.Subtitle, "twitcell");
}
if ((myList.Count != 0) && (myList.Count > 0))
{
var task = System.Threading.Tasks.Task.Factory.StartNew(() =>
{
InvokeOnMainThread(delegate
{
tableView.BeginUpdates();
cell.ImageView.Image =
LoadImage(myList.ToArray()[indexPath.Row].User.ProfileImageUrl);
tableView.EndUpdates();
});
});
cell.TextLabel.Text = myList.ToArray()[indexPath.Row].Text;
cell.DetailTextLabel.Text =myList.ToArray()[indexPath.Row].User.ScreenNameResponse;
}
return cell;
}
示例8: SetSelectedRow
public void SetSelectedRow( UITableView tableView, int row )
{
if ( row != SelectedIndex )
{
tableView.BeginUpdates( );
// setup a list with the rows that need to be redrawn
List<NSIndexPath> rowIndices = new List<NSIndexPath>();
// if there was previously a row selected, add it to our list
// so it'll be deselected
if ( SelectedIndex > -1 )
{
rowIndices.Add( NSIndexPath.FromRowSection( SelectedIndex, 0 ) );
}
// setup the newly selected index
SelectedIndex = row;
NSIndexPath activeIndex = NSIndexPath.FromRowSection( SelectedIndex, 0 );
rowIndices.Add( activeIndex );
// force a redraw on the row(s) so their selection state is updated
tableView.ReloadRows( rowIndices.ToArray( ), UITableViewRowAnimation.Fade );
tableView.EndUpdates( );
// make sure the newly selected row comes fully into view
tableView.ScrollToRow( activeIndex, UITableViewScrollPosition.Top, true );
}
}
示例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 (1, 1) }, UITableViewRowAnimation.Fade);
//---- create a new item and add it to our underlying data
tableItems[1].Items.Insert (1, new TableItem ());
//---- end animations
tableView.EndUpdates ();
}
示例10: 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 ();
}
示例11: 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 ();
}
示例12: ReactiveTableViewSource
public ReactiveTableViewSource(UITableView tableView, IEnumerable<TableSectionInformation> sectionInformation)
{
this.tableView = tableView;
this.sectionInformation = sectionInformation.ToList();
var compositeDisp = new CompositeDisposable();
this.innerDisp = compositeDisp;
for (int i=0; i < this.sectionInformation.Count; i++) {
var current = this.sectionInformation[i].Collection;
var section = i;
var disp = current.Changed.Buffer(TimeSpan.FromMilliseconds(250), RxApp.MainThreadScheduler).Subscribe(xs => {
if (xs.Count == 0) return;
this.Log().Info("Changed contents: [{0}]", String.Join(",", xs.Select(x => x.Action.ToString())));
if (xs.Any(x => x.Action == NotifyCollectionChangedAction.Reset)) {
this.Log().Info("About to call ReloadData");
tableView.ReloadData();
return;
}
int prevItem = -1;
var changedIndexes = xs.SelectMany(x => getChangedIndexes(x)).ToList();
changedIndexes.Sort();
for(int j=0; j < changedIndexes.Count; j++) {
// Detect if we're changing the same cell more than
// once - if so, issue a reset and be done
if (prevItem == changedIndexes[j] && j > 0) {
this.Log().Info("Detected a dupe in the changelist. Issuing Reset");
tableView.ReloadData();
return;
}
prevItem = changedIndexes[j];
}
this.Log().Info("Beginning update");
tableView.BeginUpdates();
var toChange = default(NSIndexPath[]);
foreach(var update in xs.Reverse()) {
switch(update.Action) {
case NotifyCollectionChangedAction.Add:
toChange = Enumerable.Range(update.NewStartingIndex, update.NewItems != null ? update.NewItems.Count : 1)
.Select(x => NSIndexPath.FromRowSection(x, section))
.ToArray();
this.Log().Info("Calling InsertRows: [{0}]", String.Join(",", toChange.Select(x => x.Section + "-" + x.Row)));
tableView.InsertRows(toChange, UITableViewRowAnimation.Automatic);
break;
case NotifyCollectionChangedAction.Remove:
toChange = Enumerable.Range(update.OldStartingIndex, update.OldItems != null ? update.OldItems.Count : 1)
.Select(x => NSIndexPath.FromRowSection(x, section))
.ToArray();
this.Log().Info("Calling DeleteRows: [{0}]", String.Join(",", toChange.Select(x => x.Section + "-" + x.Row)));
tableView.DeleteRows(toChange, UITableViewRowAnimation.Automatic);
break;
case NotifyCollectionChangedAction.Replace:
toChange = Enumerable.Range(update.NewStartingIndex, update.NewItems != null ? update.NewItems.Count : 1)
.Select(x => NSIndexPath.FromRowSection(x, section))
.ToArray();
this.Log().Info("Calling ReloadRows: [{0}]", String.Join(",", toChange.Select(x => x.Section + "-" + x.Row)));
tableView.ReloadRows(toChange, UITableViewRowAnimation.Automatic);
break;
case NotifyCollectionChangedAction.Move:
// NB: ReactiveList currently only supports single-item
// moves
this.Log().Info("Calling MoveRow: {0}-{1} => {0}{2}", section, update.OldStartingIndex, update.NewStartingIndex);
tableView.MoveRow(
NSIndexPath.FromRowSection(update.OldStartingIndex, section),
NSIndexPath.FromRowSection(update.NewStartingIndex, section));
break;
default:
this.Log().Info("Unknown Action: {0}", update.Action);
break;
}
}
this.Log().Info("Ending update");
tableView.EndUpdates();
});
compositeDisp.Add(disp);
}
}
示例13: RowSelected
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
System.Diagnostics.Debug.WriteLine(tableView.CellAt(indexPath));
tableView.BeginUpdates();
switch (indexPath.Section)
{
case 0:
{
switch (indexPath.Row)
{
case 0: // hemisphere
_editingHemisphere = !_editingHemisphere;
tableView.CellAt(NSIndexPath.FromRowSection(indexPath.Row + 1, indexPath.Section)).Hidden = !_editingHemisphere;
break;
case 2: // speed
_editingSpeed = !_editingSpeed;
tableView.CellAt(NSIndexPath.FromRowSection(indexPath.Row + 1, indexPath.Section)).Hidden = !_editingSpeed;
break;
}
}
break;
}
tableView.EndUpdates();
tableView.DeselectRow(indexPath, true);
}
示例14: AddNewRow
/// <summary>
/// Adds new row
/// </summary>
private void AddNewRow(UITableView tableView, NSIndexPath indexPath)
{
string bookmakrName = string.IsNullOrEmpty(mController.mNewBookmarkNameTxt.Text)
? string.Format("Bookmark {0}".t(), mController.mBookmarks.Count + 1)
: mController.mNewBookmarkNameTxt.Text;
tableView.BeginUpdates();
var newIndexPath = NSIndexPath.FromRowSection(indexPath.Row + mController.mBookmarks.Count + 1, 0);
var newBookmark = new DocumentBookmark(mController.mDocumentId, -1, bookmakrName, mController.mCurrentPageNumber);
DocumentBookmarkManager.Instance.SaveBookmark(newBookmark);
mController.mBookmarks.Add(newBookmark);
mController.mBookmarksTable.InsertRows(new NSIndexPath[] { newIndexPath }, UITableViewRowAnimation.Fade);
tableView.EndUpdates();
mController.SetEditingMode(UITableViewCellEditingStyle.None);
}
示例15: 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 ();
}