Book Image

Xamarin Mobile Application Development for iOS

By : Paul F. Johnson
Book Image

Xamarin Mobile Application Development for iOS

By: Paul F. Johnson

Overview of this book

<p>Before the release of monotouch, development on iOS was purely in Objective C. There was nothing wrong with that except for one thing – it’s very unpleasant to write code in! The release of Xamarin changed all of that, and with it brought cross-platform development to the mobile world.<br /><br />Xamarin Mobile Application Development for iOS is not just your normal everyday book on iOS app development. Everything is written for a point and not for effect, and therefore you will learn everything you need to know quickly and efficiently without getting bogged down in needless information. The code has been taken from fully tested apps, so you can just drop it into your code and it will work out of the box.<br /><br />In this clear and informative guide, you will be taken on a whirlwind tour of iOS application development with Xamarin, from setting up a development environment on your PC or Mac to testing and distribution through the Apple Store with plenty of practical examples along the way.</p> <p>The book begins by discussing the installation of the IDE (for both PC and Mac) as well as how to set up your PC so it can be used to develop for iOS. From there, successive chapters cover the user interface, views, view controllers, customisation of controls, animation, events and event handling, getting the most from your app using threading, creating your own settings system, the internal database system and LINQ, sending texts, making calls, taking photos, videos, and audio recordings as well as using the mapping system. The book culminates by showing you how to test your app using testflight and finally how to release your app on the Apple Store. It is an all-encompassing book that leaves nothing out.</p>
Table of Contents (22 chapters)
Xamarin Mobile Application Development for iOS
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Welcome to this book! What you will find between the covers of this book will hopefully set you on your way to producing your own iOS applications; not only that, it will also help you to start writing code that can be moved with the minimum fuss to Android and Windows 8 mobile phones and tablets. Hold on to your hats folks!

What this book covers

Chapter 1, Installing the Xamarin Product Range for Android and iOS, explains how to set up your PC or Mac to develop apps for your iOS device.

Chapter 2, The User Interface, deals with creating a user interface and its key components.

Chapter 3, Views and Layouts, explains how creating a user interface isn't just about putting buttons on a screen; you also need to start with the right application type.

Chapter 4, Controllers, gives the basics of the two most used forms of Navigation and View. iOS uses an MVC system (Model, View, Controller). We've had the first two, now let's see about controllers.

Chapter 5, UI Controls, explains how the controls are more than just buttons and textboxes; we can really go to town on how these bad boys look.

Chapter 6, Events, explains how, without events, your iOS device is nothing more than a lump of plastic. iOS is rich in events, and they're all here.

Chapter 7, Gestures, covers the operations that iOS makes a big play on, such as being able to pinch, sweep, and move around the screen. These operations are called gestures and they're very simple to use!

Chapter 8, Threading, deals with iOS as a multithreaded system. How these threads interact determines how an app will behave.

Chapter 9, Threading Tasks, deals with task scheduling as well as asynchronous tasks. It explains how Android works with these tasks.

Chapter 10, Animation, gives an insight into animation, as it is an important part of any app.

Chapter 11, Handling Data, explains how it is surprisingly easy to handle and manipulate large amounts of complex data within C# and iOS.

Chapter 12, Peripherals, explains how to code to take advantage of the calling and texting feature on your phone as well as use the GPS system.

Chapter 13, User Preferences, explains how to store your settings for the built-in system as well as create your own cross-platform settings code. Storing your settings is a very important part of any app.

Chapter 14, Testing and Publishing, deals with how to test and publish the app after you have finished developing it.

What you need for this book

A Mac (running OS.X Lion or Mountain Lion) with Xcode installed and a copy of Xamarin.iOS (you can use the free download version from www.xamarin.com). If you're using a PC, you'll need to be running Windows 7. It will need a Mac somewhere on the network to deploy and use Xcode from.

An iPhone or iPad is also useful.

Who this book is for

This book is for those who already code in C#; it is the basic assumption used. You need not have ever written anything for a mobile device or have coded in Objective C. If you're interested in developing code for iOS, then you're in the right place.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "A UIImageView has no events attached to it, so if you need an image that can be clicked on, they can be planted onto a UIButton class "

A block of code is set as follows:

var r = new UIButton();
r.Frame = new RectangleF(0, 0, 100f, 100f);// button 100 x 100 at 0, 0
var i = new UIImageView(new RectangleF(15f, 2f, 70f, 70f));
i.Image = UIImage.FromFile("path/toimage.png")Scale(new SizeF(70f, 70f));
var l = new UILabel(new RectangleF(2f, 78f, 96f, 20f));
l.Text = "Hello world";
r.AddSubview(i);
r.AddSubview(l);

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The class needs to be defined in the connector as both an outlet and action (with the Event selected to be Value Changed)."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.