Book Image

iOS Development with Xamarin Cookbook

By : Dimitrios Tavlikos (USD)
Book Image

iOS Development with Xamarin Cookbook

By: Dimitrios Tavlikos (USD)

Overview of this book

Table of Contents (22 chapters)
iOS Development with Xamarin Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Displaying content larger than the screen


In this recipe, we will learn how to display content that extends beyond the screen's bounds.

Getting ready

In this recipe, we will discuss the UIScrollView control. Create a new iPhone Single View Application project and name it ScrollApp.

How to do it...

The following are the steps to create the project:

  1. Open the ScrollAppViewController.xib file in Interface Builder.

  2. Add a UIScrollView object on its view and connect it to an outlet. Save the document.

  3. 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...