本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例6: ScrollIntoViewPartial
public static void ScrollIntoViewPartial(UIScrollView scrollViewer, CoreGraphics.CGRect frame)
{
PointF nextPoint = new PointF(0, (float)frame.Top +100);
scrollViewer.SetContentOffset(nextPoint, true);
}
示例7: ScrollIntoView
public static void ScrollIntoView(UIScrollView scrollViewer, RectangleF frame)
{
PointF nextPoint = new PointF(0, frame.Top - 40);
scrollViewer.SetContentOffset(nextPoint, true);
}
示例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);
});
}
}
示例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();
}
示例10: ScrollToLeft
private void ScrollToLeft(UIScrollView scrollView)
{
if (scrollView != null)
scrollView.SetContentOffset(new PointF(0, 0), true);
cell.cellState = SWCellState.Left;
cell.OnScrolling();
}