Book Image

iOS Development using MonoTouch Cookbook

By : Dimitris Tavlikos
Book Image

iOS Development using MonoTouch Cookbook

By: Dimitris Tavlikos

Overview of this book

<p>MonoTouch brings the amazing revenue opportunities of Apple’s billion dollar app store to C# and .NET developers. <br /><br />This cookbook leaves no stone unturned, providing you with practical recipes covering user interfaces, data management, multimedia , web services, and localization, right through to application deployment on the app store.<br /><br />Whatever the area of MonoTouch iOS development you need to know about, you will find a recipe for it in this cookbook. Minimum theory and maximum practical action defines this book. It is jam packed with recipes for interacting with the device hardware, like the GPS, compass and the accelerometer. Recipes for those all important real world issues such as designing the UI with the integrated designer introduced with Xcode 4. It is the essential cookbook for C# and .NET developers wanting to be part of the exciting and lucrative world of iOS development.</p>
Table of Contents (22 chapters)
iOS Development Using MonoTouch Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Regional formatting


Regional formatting is how various information, such as currency, date and time, and so on, is displayed according to different regions of the world. In this recipe, we will discuss how to display formatted numbers and dates according to the user's regional formatting settings.

Getting ready

Create a new project in MonoDevelop and name it RegionalFormattingApp.

How to do it...

  1. Add five labels on the view of MainController. Enter the following code in the MainController class:

    public override void ViewDidAppear (bool animated){
      base.ViewDidAppear (animated);
      this.lblLocale.Text = string.Format("Locale: {0}", NSLocale.CurrentLocale.LocaleIdentifier);
      this.lblDate.Text = string.Format("Date: {0}", DateTime.Now.ToLongDateString());
      this.lblTime.Text = string.Format("Time: {0}", DateTime.Now.ToLongTimeString());
      this.lblCurrency.Text = string.Format("Currency: {0:c}", 250);
      this.lblNumber.Text = string.Format("Number: {0:n}", 1350);
    }
  2. Compile and run the application...