当前位置: 首页>>代码示例>>C#>>正文


C# UITableView.ReloadRows方法代码示例

本文整理汇总了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;
			}
		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:26,代码来源:ListOfTableViewCell.cs

示例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);
        }
开发者ID:Redth,项目名称:WshLst,代码行数:8,代码来源:SelectableContactElement.cs

示例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;
        }
开发者ID:00091701,项目名称:ADFC-NewsApp-Mono,代码行数:12,代码来源:NewsListDelegate.cs

示例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;
		}
开发者ID:cosullivan,项目名称:Xamarin.Forms,代码行数:13,代码来源:CellRenderer.cs

示例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);
			}
		}
开发者ID:danstraughn,项目名称:XamarinMVVMLightTests,代码行数:24,代码来源:ControlExtensions.cs

示例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);
        }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:15,代码来源:MyphraseTableSource.cs

示例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();
        }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:31,代码来源:CalendarElement.cs

示例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;
				}
			}
		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:89,代码来源:ImagePostTableViewCell.cs

示例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;
		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:43,代码来源:TenServiceHelper.cs

示例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;
		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:79,代码来源:TenServiceHelper.cs

示例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);
                }
            }
开发者ID:tranuydu,项目名称:prebuilt-apps,代码行数:14,代码来源:PersonViewController.cs

示例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);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:14,代码来源:AddServicesViewController.cs

示例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);
        }
开发者ID:BobStolk,项目名称:EventApp,代码行数:25,代码来源:FilterListViewController.cs

示例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);
                }
            }
开发者ID:Jusliang,项目名称:Ma-Phrase-Book,代码行数:19,代码来源:PhraseScreen.cs


注:本文中的UITableView.ReloadRows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。