O'Reilly logo

Xamarin 4.x Cross-Platform Application Development - Third Edition by Jonathan Peppers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Composing messages

For the final piece of our application, we need to implement some custom functionality that Apple doesn't provide with their APIs. We need to add a text field with a button that appears to be attached to the bottom of the table view. Most of this will require writing some simple C# code and wiring up events.

Let's begin by adding some new member variables to our MessagesController class, as follows:

UIToolbar toolbar; 
UITextField message; 
UIBarButtonItem send; 

We will place the text field and bar buttons inside the toolbar, as in the following code in ViewDidLoad:

public override void ViewDidLoad() { base.ViewDidLoad(); //Text Field message = new UITextField( new CGRect(0, 0, TableView.Frame.Width - 88, 32)) { BorderStyle = UITextBorderStyle.RoundedRect, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required