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 progress


In this recipe, we will discuss how to display the progress of known length.

Getting ready

In this recipe, we will talk about the UIProgressView control. This control provides a similar functionality to the ProgressBar control in .NET. Create a new iPhone Single View Application project in Xamarin Studio and name it ProgressApp.

How to do it...

The following are the steps for using the UIProgressView class. Note that in this recipe, we will add all the controls programmatically without the use of Interface Builder.

  1. Add the following using directives in the ProgressAppViewController class file:

    using System.Drawing;
    using System.Threading;
    using System.Threading.Tasks;
  2. Add the following fields in the class:

    UILabel labelStatus;
    UIButton buttonStartProgress;
    UIProgressView progressView;
    float incrementBy = 0f;
  3. Enter the following code in the ViewDidLoad override:

    // Initialize the label
    this.labelStatus = new UILabel (new RectangleF (60f, 60f, 200f, 50f));
    this.labelStatus.AdjustsFontSizeToFitWidth...