Book Image

iOS Development with Xamarin Cookbook

By : Dimitrios Tavlikos (USD)
Book Image

iOS Development with Xamarin Cookbook

By: Dimitrios Tavlikos (USD)

Overview of this book

Table of Contents (22 chapters)
iOS Development with Xamarin Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Customizing rows


In this recipe, we will create a table view that uses our own custom subclass of UITableViewCell to display data.

Getting ready

Create a new project in Xamarin Studio in the same manner in which the project in the earlier recipe was created. Name it CustomRowsApp.

How to do it...

Perform the following steps:

  1. Add a new class to the project and name it CustomCell.

  2. Implement the class with the following code:

    [Register("CustomCell")]
    public partial class CustomCell : UITableViewCell {
      public const string CELLID = "CustomCell";
      public CustomCell (IntPtr handle) : base(handle) {}
      [Outlet("lblTitle")]
      public UILabel LabelTitle { get; private set; }
      [Outlet("imgView")]
      public UIImageView ImgView { get; private set; }
    }
  3. Add a new Empty iPhone Interface Definition to the project and name it CustomCell. Don't worry about the name conflicting with the class we created earlier, as this is an XIB file. Open the file in Interface Builder.

  4. Add UITableViewCell on the canvas. The following...