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


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

See Also




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 UIKit.UIScrollView with the ContentOffset property set to System.Drawing.PointF[0,0] (left image) with the appearance when ContentOffset is set to System.Drawing.PointF [240,170] (right image).

C# Example

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: http://creativecommons.org/licenses/by-sa/2.5/deed.en

Assignment to this value will move the subview instantaneously. If animation is desired, use UIScrollView.SetContentOffset.


Namespace: UIKit
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: