In this recipe, we will learn how to display content that extends beyond the screen's bounds.
In this recipe, we will discuss the UIScrollView
control. Create a new iPhone Single View Application project and name it ScrollApp
.
The following are the steps to create the project:
Open the
ScrollAppViewController.xib
file in Interface Builder.Add a
UIScrollView
object on its view and connect it to an outlet. Save the document.Back in Xamarin Studio, add the following code in the
ScrollAppViewController
class:// Image view UIImageView imgView; public override void ViewDidLoad() { base.ViewDidLoad(); this.imgView = new UIImageView (UIImage.FromFile ("Kastoria.jpg")); this.scrollView.ContentSize = this.imgView.Image.Size; this.scrollView.ContentOffset = new PointF (200f, 50f); this.scrollView.PagingEnabled = true; this.scrollView.MinimumZoomScale = 0.25f; this.scrollView.MaximumZoomScale = 2f; this.scrollView.ViewForZoomingInScrollView...