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


C# UIScrollView.SetContentOffset方法代码示例

本文整理汇总了C#中UIScrollView.SetContentOffset方法的典型用法代码示例。如果您正苦于以下问题:C# UIScrollView.SetContentOffset方法的具体用法?C# UIScrollView.SetContentOffset怎么用?C# UIScrollView.SetContentOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIScrollView的用法示例。


在下文中一共展示了UIScrollView.SetContentOffset方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: KeyboardWillHide

		public static void KeyboardWillHide (this NSNotification notification, ref bool keyboardIsShown, UIScrollView containerView)
		{
			if(!keyboardIsShown){
				return;
			}

			var keyboardFrame = UIKeyboard.FrameEndFromNotification (notification);

			Action animation = () => {
				containerView.SetContentOffset(new CGPoint(containerView.ContentOffset.X, containerView.ContentOffset.Y - keyboardFrame.Height + 30), true);
			};

			UIScrollView.Animate (50d, 0d, UIViewAnimationOptions.CurveLinear, animation, null);

			keyboardIsShown = false;
		}
开发者ID:EckyZero,项目名称:Hashtagg,代码行数:16,代码来源:NotificationExtensions.cs

示例2: SlidingCell

        public SlidingCell(string resuseIdentifier)
            : base(UITableViewCellStyle.Default, resuseIdentifier)
        {
            scrollView = new UIScrollView();
            scrollView.ShowsHorizontalScrollIndicator = false;
            scrollView.Delegate = new SlidingCellScrollDelegate(this);
            tapGesture = new UITapGestureRecognizer ();
            tapGesture.AddTarget (() => {
                if (scrollView.ContentOffset != PointF.Empty)
                {
                    scrollView.SetContentOffset(PointF.Empty, false);
                    return;
                }

                var table = this.Superview.Superview as UITableView;
                var indexPath = table.IndexPathForCell (this);
                table.Source.RowSelected (table, indexPath);
            });
            scrollView.AddGestureRecognizer (tapGesture);
            ContentView.AddSubview(scrollView);

            scrollViewButtonView = new UIView();
            scrollView.AddSubview(scrollViewButtonView);

            moreButton = UIButton.FromType(UIButtonType.Custom);
            moreButton.BackgroundColor = UIColor.FromRGBA(0.78f, 0.78f, 0.8f, 1.0f);
            moreButton.SetTitle("More", UIControlState.Normal);
            moreButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            scrollViewButtonView.AddSubview(moreButton);

            deleteButton = UIButton.FromType(UIButtonType.Custom);
            deleteButton.BackgroundColor = UIColor.FromRGBA(1.0f, 0.231f, 0.188f, 1.0f);
            deleteButton.SetTitle("Delete", UIControlState.Normal);
            deleteButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            scrollViewButtonView.AddSubview(deleteButton);

            scrollViewContentView = new UIView();
            scrollViewContentView.BackgroundColor = UIColor.White;
            scrollView.AddSubview(scrollViewContentView);

            scrollViewLabel = new UILabel();

            scrollViewContentView.AddSubview(scrollViewLabel);
            statusView = new UIImageView ();
            scrollView.AddSubview(statusView);
        }
开发者ID:jeffbmiller,项目名称:ShoppingList,代码行数:46,代码来源:SlidingCell.cs

示例3: LoadView

        public override void LoadView()
        {
            baseView = new UIView(UIScreen.MainScreen.Bounds);

            scrollView = new UIScrollView(new RectangleF(0,0,baseView.Bounds.Width,baseView.Bounds.Height-36)) {
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin,
                AutosizesSubviews = true,
                PagingEnabled = true,
                ShowsHorizontalScrollIndicator=false,
                ShowsVerticalScrollIndicator=false
            };

            pageControl = new UIPageControl(new RectangleF(0,baseView.Bounds.Height-36,baseView.Bounds.Width,36));

            pageControl.ValueChanged += delegate(object sender, EventArgs e) {
                var pc = (UIPageControl)sender;
                double fromPage = Math.Floor((scrollView.ContentOffset.X - scrollView.Frame.Width / 2) / scrollView.Frame.Width) + 1;
                var toPage = pc.CurrentPage;
                var pageOffset = scrollView.Frame.Width*toPage;
                Console.WriteLine("fromPage " + fromPage + " toPage " + toPage);
                PointF p = new PointF(pageOffset, 0);
                scrollView.SetContentOffset(p,true);
            };

            CreatePanels();

            baseView.AddSubview(scrollView);
            baseView.AddSubview(pageControl);

            View = baseView;
        }
开发者ID:SuperYeti,项目名称:MonoTouch-Auto-Rotate-Page-Control-View-Controller,代码行数:31,代码来源:PagingViewController.cs

示例4: SetScrollViewContentOffsetForCurrentPage

 public void SetScrollViewContentOffsetForCurrentPage(UIScrollView scrollView,bool animated)
 {
     CGPoint offset = scrollView.ContentOffset;
     offset.X = scrollView.Bounds.Width * currentPage;
     scrollView.SetContentOffset (offset, animated);
 }
开发者ID:skela,项目名称:SMPageControl,代码行数:6,代码来源:SMPageControl.cs

示例5: ScrollControlIntoView

			public static void ScrollControlIntoView(UIScrollView scrollViewer, UIControl field)
			{
				PointF nextPoint = new PointF((float)scrollViewer.Frame.X, (float)field.Frame.Top - 40);
				scrollViewer.SetContentOffset(nextPoint, true);
			}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:5,代码来源:KeyboardHelper.cs

示例6: ScrollIntoViewPartial

			public static void ScrollIntoViewPartial(UIScrollView scrollViewer, CoreGraphics.CGRect frame)
			{
				PointF nextPoint = new PointF(0, (float)frame.Top +100);
				scrollViewer.SetContentOffset(nextPoint, true);
			}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:5,代码来源:KeyboardHelper.cs

示例7: ScrollIntoView

			public static void ScrollIntoView(UIScrollView scrollViewer, RectangleF frame)
			{
				PointF nextPoint = new PointF(0, frame.Top - 40);
				scrollViewer.SetContentOffset(nextPoint, true);
			}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:5,代码来源:KeyboardHelper.cs

示例8: WillEndDragging

            public override void WillEndDragging(UIScrollView scrollView, PointF velocity, ref PointF targetContentOffset)
            {
                if (scrollView.ContentOffset.X > cell.catchWidth)
                {
                    targetContentOffset.X = cell.catchWidth;
                } else
                {
                    targetContentOffset = PointF.Empty;

                    InvokeOnMainThread(() =>
                    {
                        scrollView.SetContentOffset(PointF.Empty, true);
                    });
                }
            }
开发者ID:jeffbmiller,项目名称:ShoppingList,代码行数:15,代码来源:SlidingCell.cs

示例9: ScrollToRight

 private void ScrollToRight(UIScrollView scrollView)
 {
     if (scrollView != null)
         scrollView.SetContentOffset(new PointF(cell.ScrollLeftViewWidth * 2, 0), true);
     cell.cellState = SWCellState.Right;
     cell.OnScrolling();
 }
开发者ID:strongloop,项目名称:loopback-example-xamarin,代码行数:7,代码来源:SWTableViewCell.cs

示例10: ScrollToLeft

 private void ScrollToLeft(UIScrollView scrollView)
 {
     if (scrollView != null)
         scrollView.SetContentOffset(new PointF(0, 0), true);
     cell.cellState = SWCellState.Left;
     cell.OnScrolling();
 }
开发者ID:strongloop,项目名称:loopback-example-xamarin,代码行数:7,代码来源:SWTableViewCell.cs


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