Edytuj

Udostępnij za pośrednictwem


UIScrollView.ContentOffset Property

Definition

The offset for the origin of the content inside of a scroll view, relative to the origin of the scroll view itself.

public virtual CoreGraphics.CGPoint ContentOffset { [Foundation.Export("contentOffset")] get; [Foundation.Export("setContentOffset:")] set; }
member this.ContentOffset : CoreGraphics.CGPoint with get, set

Property Value

Implements

Attributes

Remarks

By setting the ContentOffset property, the application developer can specify the visible portion of the subview. For instance, compare the appearance of an 800x800 image in a UIScrollView with the ContentOffset property set to PointF[0,0] (left image) with the appearance when ContentOffset is set to PointF [240,170] (right image).

var scrollView = new UIScrollView ();
scrollView.ContentSize = new SizeF (800, 800);

var imageView = new UIImageView (UIImage.FromFile ("target800.png"));

scrollView.AddSubview (imageView);
scrollView.ContentOffset = new PointF (240, 170);

"An un-official 80cm FITA archery target" ©2006 Alberto Barbati, used under a Creative Commons Attribution-Share Alike 2.5 Generic license: https://creativecommons.org/licenses/by-sa/2.5/deed.en

Assignment to this value will move the subview instantaneously. If animation is desired, use SetContentOffset(CGPoint, Boolean).

Applies to

See also

  • <xref:UIKit.UIScrollView.SetContentOffset>