本文整理汇总了C#中UITableView.ReloadRows方法的典型用法代码示例。如果您正苦于以下问题:C# UITableView.ReloadRows方法的具体用法?C# UITableView.ReloadRows怎么用?C# UITableView.ReloadRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITableView
的用法示例。
在下文中一共展示了UITableView.ReloadRows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindDataToCell
public void BindDataToCell(User user, NSIndexPath indexPath, UITableView tableView){
CellUserImage.Layer.CornerRadius = 8;
CellUserImage.ClipsToBounds = true;
CellUserImage.SetImage (NSUrl.FromString (StringUtils.GetProfileImageURL(user)), UIImage.FromBundle("MyProfile"), delegate(UIImage image, NSError error, SDImageCacheType cacheType, NSUrl imageUrl) {
});
CellUsernameLabel.Text = user.username;
CellActionButton.SetImage(user.friended);
CellActionButton.RemoveTarget(null, null, UIControlEvent.TouchUpInside);
CellActionButton.TouchUpInside += async delegate {
bool results = await TenServiceHelper.SendFollowRequest(user, CellActionButton);
if (results)
{
tableView.ReloadRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.None);
}
};
if (user.IsMe()){
CellActionButton.Hidden = true;
} else {
CellActionButton.Hidden = false;
}
}
示例2: RowSelected
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
ToggleItemSelected(indexPath.Row);
tableView.ReloadRows(new [] { indexPath }, UITableViewRowAnimation.Automatic);
tableView.DeselectRow(indexPath, animated: true);
}
开发者ID:TheRealAdamKemp,项目名称:TableViewDemo,代码行数:8,代码来源:MultipleItemSelectionWithChecksViewController.cs
示例3: Selected
public override void Selected(CrossUI.Touch.Dialog.DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
this.Contact.IsSelected = !this.Contact.IsSelected;
tableView.InvokeOnMainThread(() => tableView.ReloadRows(new NSIndexPath[] { path }, UITableViewRowAnimation.None));
base.Selected(dvc, tableView, path);
}
示例4: WillSelectRow
public override MonoTouch.Foundation.NSIndexPath WillSelectRow(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
{
NewsListDataSource ds = tableView.DataSource as NewsListDataSource;
this.parentController.SelectedFeedItem = ds.GetRow(indexPath.Row);
new de.dhoffmann.mono.adfcnewsapp.buslog.database.Rss().MarkItemsAsRead(this.parentController.SelectedFeedItem.ItemID, true);
((NewsListDataSource)tableView.DataSource).ViewData.FirstOrDefault(p => p.Value.ItemID == this.parentController.SelectedFeedItem.ItemID).Value.IsRead = true;
tableView.ReloadRows(new MonoTouch.Foundation.NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade);
return indexPath;
}
示例5: WireUpForceUpdateSizeRequested
protected void WireUpForceUpdateSizeRequested(ICellController cell, UITableViewCell nativeCell, UITableView tableView)
{
cell.ForceUpdateSizeRequested -= _onForceUpdateSizeRequested;
_onForceUpdateSizeRequested = (sender, e) =>
{
var index = tableView.IndexPathForCell(nativeCell);
if (index != null)
tableView.ReloadRows(new[] { index }, UITableViewRowAnimation.None);
};
cell.ForceUpdateSizeRequested += _onForceUpdateSizeRequested;
}
示例6: LoadFromURL
/// <summary>
/// Load image async when instead of a UITableView Cell
/// </summary>
/// <param name="imgView">Image view.</param>
/// <param name="uri">URI.</param>
/// <param name="view">View.</param>
/// <param name="path">Path.</param>
public static async void LoadFromURL (this UIImageView imgView, string uri, UITableView view, NSIndexPath path)
{
try {
await Task.Factory.StartNew (() => {
using (var url = new NSUrl (uri)) {
using (var data = NSData.FromUrl (url)) {
imgView.InvokeOnMainThread (() => {
imgView.Image = UIImage.LoadFromData (data);
view.ReloadRows (new NSIndexPath[] { path }, UITableViewRowAnimation.None);
});
}
}
});
} catch (Exception ex) {
Console.WriteLine (ex);
}
}
示例7: RowSelected
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
NSIndexPath[] indexPaths = null;
if (selectedRowIndex != null) {
indexPaths = new NSIndexPath[] { indexPath, selectedRowIndex };
this.selectedRowIndex = indexPath;
} else {
this.selectedRowIndex = indexPath;
indexPaths = new NSIndexPath[] { indexPath };
}
tableView.ReloadRows (indexPaths, withRowAnimation: UITableViewRowAnimation.Fade);
PlaySound (tableItems [indexPath.Row].audioURL);
}
示例8: SlideDown
private void SlideDown(DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
this.DateValue = datePicker.Date;
tableView.ReloadRows(new NSIndexPath[]{path},UITableViewRowAnimation.None);
RectangleF screenRect = dvc.View.Window.Frame;
RectangleF endFrame = new RectangleF( datePicker.Frame.X,datePicker.Frame.Y + screenRect.Size.Height,
datePicker.Frame.Size.Width,datePicker.Frame.Size.Height);
//endFrame.origin.y = screenRect.Y + screenRect.Size.Height;
// start the slide down animation
UIView.BeginAnimations(null);
UIView.SetAnimationDuration(0.3);
// we need to perform some post operations after the animation is complete
UIView.SetAnimationDelegate(dvc);
//UIView.SetAnimationDidStopSelector(slideDownDidStop());
datePicker.Frame = endFrame;
UIView.CommitAnimations();
// remove the "Done" button in the nav bar
dvc.NavigationItem.RightBarButtonItem = rightOld;
dvc.NavigationItem.LeftBarButtonItem = leftOld;
// deselect the current table row
tableView.DeselectRow(path,true);
datePicker.RemoveFromSuperview();
datePicker = null;
if (DoneEditing != null)
DoneEditing();
}
示例9: BindDataToCell
public void BindDataToCell(Post post, UITableView tableView, NSIndexPath indexPath)
{
CellActivityIndicator.Hidden = false;
CellActivityIndicator.StartAnimating();
CellPostImageImage.Layer.CornerRadius = 8;
CellPostImageImage.ClipsToBounds = true;
CellPostImageImage.SetImage(NSUrl.FromString(StringUtils.GetPostImageURL(post)), null, delegate (UIImage image, NSError error, SDImageCacheType cacheType, NSUrl imageUrl)
{
if (image != null)
{
if (post.ImageHeight <= 0)
{
UIImage test = ImageUtils.ScaleImageToWidth(image, (float)Math.Min((float)tableView.Frame.Size.Width - 16, (float)(image.Size.Width * image.CurrentScale)));
if (test != null)
{
post.ImageHeight = (float)test.Size.Height;
}
}
CellPostImageHeight.Constant = post.ImageHeight;
SetNeedsLayout();
if (cacheType != SDImageCacheType.Memory)
{
if (Array.IndexOf(tableView.IndexPathsForVisibleRows, indexPath) > -1)
{
tableView.BeginUpdates();
tableView.ReloadRows(new NSIndexPath[1] { indexPath }, UITableViewRowAnimation.Automatic);
tableView.EndUpdates();
}
}
}
CellActivityIndicator.Hidden = true;
});
CellUserImageButton.SetUserImage(post.userPoster);
CellUsernameLabel.SetTitle(post.userPoster.username);
CellCaptionTextView.AttributedText = NativeStringUtils.ParseStringForKeywords(post, post.text);
CellLikeButton.SetImage((post.liked) ? UIImage.FromBundle("LikeSelected") : UIImage.FromBundle("Like"));
CellRepostButton.SetImage((post.isReposted) ? UIImage.FromBundle("RepostSelected") : UIImage.FromBundle("Repost"));
CellCommentButton.Image = (post.commented) ? UIImage.FromBundle("CommentSelected") : UIImage.FromBundle("Comment");
if (post.userPoster.IsMe())
{
CellLikeButton.Hidden = true;
CellRepostButton.Hidden = true;
}
else {
CellLikeButton.Hidden = false;
CellRepostButton.Hidden = false;
}
CellRepostButton.Enabled = !post.userPoster.isprivate;
if (post.userReposter != null)
{
CellRepostedLabel.Hidden = false;
CellRepostedLabel.SetTitle((post.userReposter.IsMe()) ? "by you" : "by " + post.userReposter.username);
}
else
{
CellRepostedLabel.Hidden = true;
CellRepostedLabel.SetTitle("");
}
CellTimeElapsedLabel.Text = StringUtils.GetPrettyDateAbs(post.datestamp);
if (post.IsExpired())
{
CellTimeRemaining.Expire(StringUtils.GetTopTime(post));
CellClockImage.Hidden = true;
}
else {
CellTimeRemaining.Live(StringUtils.GetPrettyDateAbs(post.expiration), ViewUtils.GetTimeRemainingColor(post.expiration));
CellClockImage.Hidden = false;
if (post.userPoster.username.ToLower() != Globe.SharedInstance.User.username.ToLower())
{
CellLikeButton.Hidden = false;
CellRepostButton.Hidden = false;
}
}
}
示例10: RepostPost
public static async Task<bool> RepostPost(Post post, UIButton repostButton, UITableView tableView = null, NSIndexPath indexPath = null)
{
if ((post.userReposter != null && post.userReposter.IsMe()) || post.userPoster.IsMe() || post.isReposted)
{
return false;
}
post.isReposted = true;
repostButton.SetImage(UIImage.FromBundle("RepostSelected"), UIControlState.Normal);
repostButton.SetImage(UIImage.FromBundle("RepostSelected"), UIControlState.Normal);
repostButton.SetImage(UIImage.FromBundle("RepostSelected"), UIControlState.Normal);
try
{
bool result = await TenServices.RepostPost(post);
if (!result)
{
post.isReposted = false;
repostButton.SetImage(UIImage.FromBundle("Repost"), UIControlState.Normal);
repostButton.SetImage(UIImage.FromBundle("Repost"), UIControlState.Normal);
repostButton.SetImage(UIImage.FromBundle("Repost"), UIControlState.Normal);
}
else {
if (tableView != null && indexPath != null)
{
tableView.ReloadRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.None);
}
}
return result;
}
catch (RESTError)
{
post.isReposted = false;
repostButton.SetImage(UIImage.FromBundle("Repost"), UIControlState.Normal);
repostButton.SetImage(UIImage.FromBundle("Repost"), UIControlState.Normal);
repostButton.SetImage(UIImage.FromBundle("Repost"), UIControlState.Normal);
}
return false;
}
示例11: LikePost
public static async Task<bool> LikePost(Post post, UIButton likeButton, UITableView tableView = null, NSIndexPath indexPath = null)
{
if (post.liked || post.IsExpired())
{
return false;
}
likeButton.SetImage(UIImage.FromBundle("LikeSelected"), UIControlState.Normal);
likeButton.SetImage(UIImage.FromBundle("LikeSelected"), UIControlState.Highlighted);
likeButton.SetImage(UIImage.FromBundle("LikeSelected"), UIControlState.Selected);
UIView.Animate(.3, delegate
{
likeButton.Transform = CoreGraphics.CGAffineTransform.MakeScale((nfloat)1.7, (nfloat)1.7);
}, delegate
{
likeButton.Transform = CoreGraphics.CGAffineTransform.MakeScale((nfloat)1, (nfloat)1);
});
if (post.userPoster.idUser != Globe.SharedInstance.User.idUser)
{
post.liked = true;
post.expiration = post.expiration + 60000;
likeButton.SetImage(UIImage.FromBundle("LikeSelected"), UIControlState.Normal);
likeButton.SetImage(UIImage.FromBundle("LikeSelected"), UIControlState.Highlighted);
likeButton.SetImage(UIImage.FromBundle("LikeSelected"), UIControlState.Selected);
AVAudioSession audioSession = AVAudioSession.SharedInstance();
NSError error = audioSession.SetCategory(AVAudioSessionCategory.Ambient, AVAudioSessionCategoryOptions.MixWithOthers);
audioSession.SetActive(true, out error);
AVAudioPlayer player = new AVAudioPlayer(new NSUrl("ticksound.m4a"), "m4a", out error);
player.NumberOfLoops = 1;
player.Play();
player.FinishedPlaying += (sender, e) =>
{
player.Stop();
player = null;
};
try
{
bool result = await TenServices.LikePost(post);
if (!result)
{
post.liked = false;
likeButton.SetImage(UIImage.FromBundle("Like"), UIControlState.Normal);
likeButton.SetImage(UIImage.FromBundle("Like"), UIControlState.Highlighted);
likeButton.SetImage(UIImage.FromBundle("Like"), UIControlState.Selected);
}
else {
if (tableView != null && indexPath != null)
{
tableView.ReloadRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.None);
}
}
return result;
}
catch (RESTError)
{
post.liked = false;
likeButton.SetImage(UIImage.FromBundle("Like"), UIControlState.Normal);
likeButton.SetImage(UIImage.FromBundle("Like"), UIControlState.Highlighted);
likeButton.SetImage(UIImage.FromBundle("Like"), UIControlState.Selected);
}
finally
{
if (!post.liked)
{
post.expiration = post.expiration - 60000;
}
}
}
return false;
}
示例12: RowSelected
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
var section = indexPath.Section;
if (section == 1) {
controller.personViewModel.ToggleFavorite ();
tableView.DeselectRow (indexPath, true);
tableView.ReloadRows (new [] { indexPath }, UITableViewRowAnimation.Automatic);
} else if (section >= 2) {
var prop = controller.personViewModel.PropertyGroups [section - 2].Properties [indexPath.Row];
controller.OnPropertySelected (prop);
}
}
示例13: RowSelected
public override void RowSelected (UITableView tableView, NSIndexPath indexPath)
{
// Get the service associated with this index.
var service = ServiceAtIndexPath (indexPath);
// Call the appropriate add/remove operation with the closure from above.
var index = selectedServices.IndexOf (service);
if (index >= 0)
selectedServices.RemoveAt (index);
else
selectedServices.Add (service);
tableView.ReloadRows (new []{ indexPath }, UITableViewRowAnimation.Automatic);
}
示例14: RowSelected
public void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
tableView.DeselectRow(indexPath, true);
Console.WriteLine("=====selected=====");
changedIndex = null;
//change accessory when indexpath is same
for (int i = 0; i < selectedIndexPaths.Count; i++)
{
var path = selectedIndexPaths[i];
if (path.Equals(indexPath))
{
selectedIndexPaths.Remove(indexPath);
changedIndex = indexPath;
}
}
if (changedIndex == null)
{
selectedIndexPaths.Add(indexPath);
changedIndex = indexPath;
}
tableView.ReloadRows(new NSIndexPath[]{ changedIndex }, UITableViewRowAnimation.Automatic);
}
示例15: RowSelected
public override void RowSelected(UITableView tableView, Foundation.NSIndexPath indexPath)
{
NSIndexPath[] indexPaths = null;
if (selectedRowIndex != null) {
indexPaths = new NSIndexPath[] { indexPath, selectedRowIndex };
this.selectedRowIndex = indexPath;
} else {
this.selectedRowIndex = indexPath;
indexPaths = new NSIndexPath[] { indexPath };
}
tableView.ReloadRows (indexPaths, withRowAnimation: UITableViewRowAnimation.Automatic);
if (search.Active) {
PlaySound (phraseController.filteredPhrases [indexPath.Row].audioURL);
} else {
PlaySound (phraseController.phrases[indexPath.Row].audioURL);
}
}