Web Development with ASPNET

The iPhone comes with the Safari web browser. With the update to the iPhone 3.x operating system, iPhone users now have a mobile version of the Safari Version 4 browser. Many .NET developers are working in ASP.NET. It is possible to build a web-based application in ASP.NET that directly targets the iPhone web browser. There are pros and cons to this strategy. The major pro to building an ASP.NET application that directly targets the iPhone is the deployment of new versions of the application....

What Is Mono Touch

Overall, the MonoTouch Application Programming Interface API is a combination of the .NET 3.5 Framework's core features and the APIs on the iPhone. MonoTouch provides a bridge interop between the iPhone's native APIs based on Objective-C and C-based APIs to the .NET world that C developers are accustomed to. MonoTouch is made up of the following four components The Monotouch.dll is a C assembly that provides a binding API into the iPhone's native APIs. These native APIs supported include...

Actions

Now that a user interface has been created, the application needs to be able to respond to user events. For those familiar with Visual Studio, creating actions also called handling events in the Windows world is a fairly easy concept. For a button in a WinForm or WebForm, double-clicking on the button results in an event being defined in the control WebForm or in the Designer.cs file WinForm , the source file opening, and the editor taking the developer to the click event. The developer can...

Info

Wrox Blox Building iPhone and iPod touch Applications for the .NET C Developer with MonoTouch By McClure - ISBN 9780470590737 Prepared for ALESSANDRO PILOTTI, email ap pilotti.it Order number 52653844 Copyright 2009, Wiley Publishing Inc. This PDF is exclusively for your use in accordance with the WroxBlox Terms of Service. No part of it may be reproduced or transmitted in any form by any means without prior written permission from the publisher. Redistribution or other use that violates the...

Binding Data to a UlTable View

The FinishedLaunching code is fairly simple. In .NET, data is typically bound by setting the .DataSource property. In ASP.NET, there is an additional step of calling the .DataBind method. The data binding against the UITableView is similar in concept. Data is found by setting the .DataSource property. I found that calling the .ReloadData method was required or the data did not bind. This may have been due to programmer error, a bug in that build of MonoTouch, or a change in the iPhone OS. The...

Customizing UTable View

You have bound some code into a UITableView. The next step is to customize the layout of the UITableView. Data outputs almost need to be customized to meet the criteria of the application. You're going to take the existing databinding application and modify the data display to look like Figure 19. In the following example, the application is modified to take the data that is displayed within three labels. To customize the UITableView, there are several steps that will need to be completed....

UIAlert View

There are times when the user needs to be presented with some information or question. MonoTouch has a UIAlertView object. The UIAlertView is instantiated with a set of parameters. On the object instance, the .Show method is called. For .NET developers, this is similar in concept to the .NET MessageBox. For JavaScript developers, this is similar to the window.alert and window.confirm methods. Figure 17 shows the output of a UIAlertView call.

Data Source

The UITableView is similar to the UIPicker control. The data source that will be bound to the control has its own requirements. The data source that will be bound inherits from UITableViewDataSource. There are two methods that the data source must implement GetCell The GetCell method creates an instance of UITableViewCell for the data row that is being bound. RowsInSelection The RowslnSelection method returns the total number of records that will be bound to the UITableView. The following code...

Accelerometer

The Accelerometer is one of the interesting features of the iPhone. The Accelerometer allows a program to read when the iPhone is moving and return data about the movement of the device. The iPhone OS and MonoTouch provide a software solution to integrating with the Accelerometer and handling acceleration events. The SharedAccelerometer is a shared C object that provides access to the acceleration hardware on the device. The following code shows how to handle acceleration events and to display...

Mono Touch

The iPhone by Apple has taken the mobile world by storm since its original release in 2007. At that point in time, the only way to target the iPhone was by either writing a web application or jailbreaking the iPhone. Neither were very good options. Writing a web application for the iPhone is not difficult, but it doesn't take advantage of the native capabilities of the device. Jailbreaking an iPhone relies on the owner of the device to install a piece of software that sidesteps the iPhone's...