In this recipe, we will discuss how to display the progress of known length.
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
.
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.
Add the following
using
directives in theProgressAppViewController
class file:using System.Drawing; using System.Threading; using System.Threading.Tasks;
Add the following fields in the class:
UILabel labelStatus; UIButton buttonStartProgress; UIProgressView progressView; float incrementBy = 0f;
Enter the following code in the
ViewDidLoad
override:// Initialize the label this.labelStatus = new UILabel (new RectangleF (60f, 60f, 200f, 50f)); this.labelStatus.AdjustsFontSizeToFitWidth...