Wiley
Wiley.com
Print this page Share

Professional iPhone Programming with MonoTouch and .NET/C#

ISBN: 978-0-470-63782-1
384 pages
July 2010
Professional iPhone Programming with MonoTouch and .NET/C# (047063782X) cover image

Description

What .NET C# developers need to enter the hot field of iPhone apps

iPhone applications offer a hot opportunity for developers. Until the open source MonoTouch project, this field was limited to those familiar with Apple’s programming languages. Now .NET and C# developers can join the party. Professional iPhone Programming with MonoTouch and .NET/C#is the first book to cover MonoTouch, preparing developers to take advantage of this lucrative opportunity.

This book is for .NET developers that are interested in creating native iPhone applications written in .NET/C#. These developers want to use their existing knowledge. While .NET developers are always interested in learning, they also recognize that learning Objective-C and the specifics of the iPhone can be overwhelming. Those developers interested in MonoTouch will recognize that the cost of MonoTouch is easily made up by the ability to quickly target the iPhone using a language that they are already familiar with.

This book is designed for .NET developers that want to target the iPhone. It is designed to help you get up to speed with the iPhone, not to really teach you about the .NET Framework or C# language, which we assume you already know.

This book is designed with introductory material in Chapters 1 thru 4. You should read Chapters 1 thru 4 sequentially. These chapters introduce the MonoTouch product, the basics of developing with MonoTouch and MonoDevelop, and finally, the basics of presenting data to a user with screen and data controls and how to develop a user interface for the iPhone. Once you are comfortable with these concepts, you can typically move from one chapter to another and not necessarily have to read the chapters sequentially

See More

Table of Contents

FOREWORD xxi

INTRODUCTION xxiii

CHAPTER 1: INTRODUCTION TO IPHONE DEVELOPMENT WITH MONOTOUCH FOR C# DEVELOPERS 1

Product Comparison 2

.NET Framework 2

Mono 2

MonoTouch 3

MonoDevelop 5

iPhone 5

Mobile Development 7

Apple iPhone SDK Tools 8

Tools 8

Licensing 9

Summary 9

CHAPTER 2: INTRODUCTION TO MONOTOUCH 11

Before You Begin Developing 11

The Components of MonoTouch 12

What Is Mono? 12

Namespaces and Classes of MonoTouch 13

Working with MonoDevelop 16

Using Interface Builder 19

Working with Library Controls 20

Setting Up Outlets 22

Setting Up Actions 24

Hello World with Interface Builder 25

Hello World in Code 28

Debugging 30

On the Simulator 30

On the Device 30

Understanding the Linker 31

Deploying Your Application 32

Summary 33

CHAPTER 3: PLANNING YOUR APP’S UI: EXPLORING THE SCREEN CONTROLS 35

Creating iPhone(y) UI and Application Interaction Patterns 35

Command Interfaces 36

Radio Interfaces 37

Navigation Interfaces 37

Modal Interfaces 38

Combination Interfaces 38

UILabel 39

UIButton 40

UITextField 42

UISwitch 43

UISlider 44

UIActivityIndicatorView 44

UISegmentedControl 45

UIPageControl 46

Summary 46

CHAPTER 4: DATA CONTROLS 49

Windows and Views 50

UIWindow 51

UIView 52

Data View Controls 52

UIWebView 52

UIScrollView 58

UITextView 61

UIPickerView 65

UIDatePicker 69

Controllers and Bars 71

UIViewController 72

UIToolbar 73

UITabBarController 76

UINavigationController 82

Summary 85

CHAPTER 5: WORKING WITH DATA ON THE IPHONE 87

Working with SQLite 87

Using Mono.Data.Sqlite 88

Setting Up a Database 88

Setting Up Tables 89

Using SQL Statements 90

Upgrading Strategies 92

Working with Remote Data 93

Using SOAP 94

Using REST-Based Web Services 98

Retrieving Data 99

Posting Data with POST 104

Using Web Services Responsibly 106

Summary 106

CHAPTER 6: DISPLAYING DATA USING TABLES 107

Displaying Data in a Table 109

Selecting a Cell 111

Changing the Cell Layout 113

Presenting Grouped Data 114

Adding an Index 118

Grouped Table Style 119

Customizing the Cell Layout 120

Navigating with Tables 123

Using UINavigationController 123

Implementing a Second Level of Navigation 126

Creating Static Row Content 127

Editing Table Rows 130

Adding Swipe to Delete 130

Enabling Edit “Mode” 131

Re-Ordering Cells 132

Creating an Insert Icon 133

Adding New Rows 134

Adding a Search Bar to a Table 136

Enabling the Search Bar 137

Customizing Search Appearance 140

Summary 140

CHAPTER 7: MAPPING 141

Map Basics 142

Introducing MapKit 142

Introducing CoreLocation 142

Using CoreLocation 145

Determining Device Location 145

Tracking Device Movement 150

Using MapKit 154

Showing a Map 156

Annotating the Map 158

Using the Geocoding Feature 167

Summary 172

CHAPTER 8: APPLICATION SETTINGS 173

Exploring the Info.plist 173

UIStatusBarHidden 174

UIInterfaceOrientation 175

UIRequiresPersistentWiFi 175

UIPrerenderedIcon 175

Peeking in the Settings Bundle 175

The Settings Application 176

Adding Your App to the Settings Application 176

Reading Your Settings 188

Updating Your Settings 189

Summary 189

CHAPTER 9: PROGRAMMING WITH DEVICE HARDWARE 191

Responding to Acceleration 192

Accelerometer 192

Using the XYZ Coordinate System 192

Coding with the Accelerometer 193

Using Acceleration for UI Input 194

Determining Device Orientation 196

Beginning Notification 196

Determining Static Device Orientation 196

Determining Event-Based Orientation 197

Reading the Proximity Sensor 198

Networking 199

Taking Battery Life into Account 200

Determining the Static Battery State 200

Using Battery Change Events 201

Accessing System Information 201

Mobile Development 202

Summary 202

CHAPTER 10: PROGRAMMING WITH MULTIMEDIA 203

Images 203

Displaying Images 203

Picking an Image 206

Handling a Picked Image 208

Creating an Image from the Camera 209

Editing an Image 210

Customizing the Camera 211

Saving an Image to the Photo Album 212

Video 213

Playing a Video 213

Customizing the Video Player 215

Picking a Video 218

Recording Video 219

Editing a Video 221

Saving a Video to the Saved Photo Album 222

Audio 223

Playing Audio 223

Recording Audio 225

Animation 227

Creating Basic Animation 227

Using UIView Animations 229

Summary 231

CHAPTER 11: TALKING TO OTHER APPLICATIONS 233

Integrating Apple Applications 233

Opening Up Safari 233

Opening Up E-Mail 234

Making a Telephone Call 234

Sending a Text/SMS Message 235

Opening a Location in the Maps Application 235

Opening a YouTube Video 235

Opening Up the iTunes Store and the App Store 236

Third-Party Application Integration 236

Simple Integration with Google Earth 236

Further Integration with Skype 237

Accepting Calls from Other Applications 237

Configuring Your Info.plist File 238

Implementing an OpenURL Schema 240

Integrating with the Address Book 240

ABPersonViewController 242

ABPeoplePickerNavigationController 243

ABNewPersonViewController 244

ABUnknownPersonViewController 245

Handling the Selection of Properties 247

Integrating with iPod Music Collections 248

Interfacing with Objective-C 252

MonoTouch.Foundation 252

MonoTouch.ObjCRuntime 253

Automatic Binding to Objective-C with btouch 253

Summary 257

CHAPTER 12: LOCALIZING FOR AN INTERNATIONAL AUDIENCE 259

Internationalizing an Application 261

Changing Language and Region Settings 261

Displaying Multiple Languages 263

Showing Translated Text 265

Displaying Images 269

Localizing App Icon and Name 271

Displaying “Double Byte” Characters 271

Formatting Dates, Times, Numbers and Currency 272

Managing Localized.strings in Real-World Applications 274

genstrings 274

ngenstrings 274

Summary 276

CHAPTER 13: PROGRAMMING THE IPAD 277

The iPad Device 277

What Makes an iPad Application? 279

Device Orientation Support 280

Startup Images 282

New iPad Features 284

Using UISplitViewController 284

Creating a Custom UIPopover 288

Displaying Modal Views 291

Recognizing Gestures 292

Building a Universal App 296

Summary 302

CHAPTER 14: JUST ENOUGH OBJECTIVE-C 303

How to Use This Chapter 304

A Brief Look at Objective-C and Cocoa 305

Academic Versus Pragmatic Approaches 307

Basic Syntax and Concepts 308

Initialization 309

Messages and Methods 311

Memory Management 313

Cheat Sheets 314

Terminology 314

Compiler Directives 316

Data Types 319

Summary 320

CHAPTER 15: THE APP STORE: SUBMITTING AND MARKETING YOUR APP 321

Using an Ad-Hoc Build for Presubmission Testing 321

Getting a UDID from Your Testers 322

Making Ad-Hoc Provisioning Profiles 324

Building an Ad-Hoc Version of Your App 325

Packaging Your Ad-Hoc Build 326

Prepping for Submission 329

Building a Distribution Version of Your App 329

Adding a New Configuration for Distribution 329

Changing the Signing Options for the Configuration 330

Reviewing Bundle Settings 330

Building the Project 330

Presubmission Checklist 330

Submitting via iTunes Connect 331

Promoting Your App 333

Supporting Your App Promotion 333

Key App Promotion Techniques 334

Summary 337

INDEX 339

See More

Author Information

Wallace B. McClure is a Microsoft MVP, ASPInsider, member of the national INETA Speaker's Bureau, and has a popular blog and podcast.

Martin Bowling is a software developer and marketer working with small and medium sized businesses.

Craig Dunn has worked on web technologies in corporate environments since 1993.

Chris Hardy, an ASPInsider, works at a digital agency in Manchester, UK.

Rory Blyth has worked in the software development industry for nearly a decade.

See More

Downloads

Download TitleSizeDownload
ReadMe File 597 bytes Click to Download
Professional iPhone Programming with MonoTouch and .NET/C# - Full Code Download 19.24 MB Click to Download
Chapter 2: Introduction to MonoTouch 12.88 KB Click to Download
Chapter 4: Data Controls 1.84 MB Click to Download
Chapter 5: Working with Data 80.57 KB Click to Download
Chapter 6: Displaying Data Using Tables 86.05 KB Click to Download
Chapter 7: Mapping 48.82 KB Click to Download
Chapter 8: Application Settings 7.84 KB Click to Download
Chapter 9: Device Support 639.38 KB Click to Download
Chapter 10: Programming with Multimedia 5.47 MB Click to Download
Chapter 11: Talking to Other Applications 245.19 KB Click to Download
Chapter 12: Internationalization/Localization 887.83 KB Click to Download
Chapter 13: iPad 9.93 MB Click to Download
Chapter 14: Objective-C for MonoTouch Devs 23.16 KB Click to Download
See More

Errata

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
12 Update for Link
download the iPhone sdk link:
www.apple.com/downloads/macosx/development_tools/iphonesdk.html

should now be:
http://developer.apple.com/devcenter/ios/index.action
10/20/11
120 Error in Text
"ViewInterfaceDefinition" should be "iPHoneView"
11/04/2010
See More

Press Release

September 02, 2010
WILEY GIVES .NET / C# DEVELOPERS THE TOOLS TO JOIN THE IPHONE APP GOLD RUSH

 

The runaway success of Apple’s iPhone has created a new industry for developers: Apps.  In fact, research from the Yankee Group estimates that nearly 7 billion U.S. smartphone app downloads will produce $4.2 billion in revenue by 2013.  They also estimate the number of smartphone users is set to quadruple to 160 million users over the same period, resulting in an app market "gold rush”.  Using Apple’s X-Code development package, developers are making small fortunes creating everything from games to to-do list managers for this growing platform.  Unfortunately, the learning curve on Apple’s development platform can be long and complex leaving millions of Windows developers out in the cold.   Now, using the MonoTouch project, .NET/C# developers can join the party.  Wiley has released a free ebook for .NET & C# developers to hit the ground running, BUILDING iPHONE AND iPOD TOUCH APPLICATIONS FOR THE .NET/C# DEVELOPER WITH MONOTOUCH (http://www.wrox.com/WileyCDA/Section/id-406371.html). Additionally, author Wallace B. McClure has also produced a downloadable video podcast introducing MonoTouch available from http://aspnetpodcast.com.

For developers that want to take their iPhone development skills to the next level, McClure also wrote the first book to completely cover MonoTouch, PROFESSIONAL IPHONE PROGRAMMING WITH MONOTOUCH AND .NET/C# (Wiley; July 2010; $44.99). Designed so developers can use their existing skill set, the first four chapters introduce the MonoTouch product, the basics of developing with MonoTouch and MonoDevelop, the basics of presenting data to a user with screen, and finally, data controls and how to develop a user interface for the iPhone, iPad, and iPod touch.  From there, developers are free to jump around the remaining 9 chapters covering:

 

* Working with Data on the iPhone

* Displaying Data Using Tables

* Mapping

* Application Settings

* Programming with Device Hardware








    

 

* Programming with Multimedia

* Talking to Other Applications

* Localizing for an International Audience

* Programming the iPad

* Objective-C basics

* Submitting and Marketing an App

 

 

 

 

 

 

MonoTouch has opened the white-hot field of Apple iPhone application development to millions of .NET C# developers. Wiley is setting these developers up with everything they need to get up and running, from a free ebook to in-depth coverage of the MonoTouch development platform. BUILDING iPHONE AND iPOD TOUCH APPLICATIONS FOR THE .NET/C# DEVELOPER WITH MONOTOUCH and PROFESSIONAL IPHONE PROGRAMMING WITH MONOTOUCH AND .NET/C# are fantastic resources for any .NET/C# developer that wants to get their piece of the iPhone App pie.

ABOUT THE AUTHORS:

Wallace B. "Wally" McClure has been working with .NET since 2000, specializing in applications with large numbers of users and large amounts of data, as well as user interface technologies, such as AJAX and the iPhone. He is a Microsoft MVP, ASPInsider, member of the national INETA Speaker's Bureau, and has a popular blog and podcast. 

Chris Hardy works with open source technologies such as PHP and Castle's Monorail and technologies such as ASP.NET MVC and jQuery while achieving clean markup and HTML.

Craig Dunn has worked on web technologies in corporate environments since 1993. He has since worked on screenphone-based information services and handheld device apps such as outdoor event ticket scanning.

Martin Bowling is a software developer and marketer working with small and medium sized businesses, developing Digital Marketing strategies. Recently his work has included several commercial iPhone applications.

 

See More

Related Titles

Back to Top