What Is MonoTouch

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 Qwp

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 UlTableView

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 UTableView

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....

UIAlertView

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.

Info Gkx

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...

UlPicker

Given that there is a limited set of schemes and protocols that are supported in an iPhone, it makes sense to present a limited set of data to the user for selection. For those familiar with the Windows operating system and .NET, some type of dropdown list control would be used. The iPhone operating system does not contain a control that looks like that control. The closest control is the UIPicker control, which is shown in Figure 15. The UIPicker is visually different, but there are also...

DataSource

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...

Info Bhn

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...

MKMapView

The iPhone contains the MKMapView class, which is an embeddable map interface. The control can be set up on the IB design surface exactly the same as the other user controls. The application has a text field to allow users to put in a location and a button to initiate a series of actions that will call a web service to geocode the location, display the general area of the location, and place a point in the center of the geocoded location. Figure 11 shows the UI of the application in IB.

Contents

Visual Studio .NET o MonoDevelop 4 Introduction to Development on the Mac with MonoDevelop 6 Interacting with Other Applications 22 Binding Data to a UITableView 29 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...