Creating Custom TableViewCell

Dheeraj Kumar Gunti

Reading Time : ( words)


Hello All, Welcome back again.

In General Application development presentation is the key item to be concentrated first. If we have TableViews in our application presenting them in beautiful way is a key challenge. If we want to have custom design for representing list of items with TableViews then we need to go with CustomTableViewCells.

Following is the step by step example for creating Custom TableViewCell.

Open Xamarin Studio and Create a new Application.



Once the default skeleton is created. Add a ViewController to the solution.



Open the View Controller and Create a Sample Class with two properties.

Create a TableSource which populates all the data to the table.

On the ViewDidLoad create an object for TableView and create a object for TableViewSource and add the TableView to the ParentView.

Populate some test data to the Person.

Right Click on the Project and Add New File and Choose iOS section and Select iPhone Table View Cell



Once the file is successfully created in the project. Open the .XIB file in Interface Builder and design the scree as below.



Open the CustomCell.designer.cs file and you can able to see the outlets got created.

In the TableView Source GetCell method you can see how we are accessing CustomTableViewCell and its properties.


Output:



Enjoy Coding.... :)