Creating Sectioned TableView With Alphabetical Order

Dheeraj Kumar Gunti

Reading Time : ( words)


Its Very important to have items in Alphabetical Order that are displayed in TableView with respect to easy navigation. Here is the sample which helps in displaying items in Alphabetical Order.

Create a Solution and Add a new View Controller.

Do add a TableView either using Xib or by creating a new instance of tableview and adding it to view.

Create two properties,

Have some data which populates to the TableView.

Specify the source for TableView by create TableSource and Pass the List of items to that.

Create a TableViewSource.

In the TableViewSource has some properties as below,

In the TableViewSource constructor have a logic which gets the section names and add items to that section. Here we are using a dictionary which stores the section and elements which match the criteria in to the sections.

Specify the Number of sections,

Specify the title of the section,

Specify number of items in each section,

Bind the data with the item value in GetCell.


Output:



Enjoy Coding....