ListView: Populating with data
There are two ways to feed TKListView data you need to display. You can do that by implementing several methods from the TKListViewDataSource protocol or you could let the TLKDataSource component do the dirty work for you.
Populating with data using TKDataSource
TKDataSource contains implementation of the TKListViewDataSource protocol that you may use out-of-the box. In addition TLKDataSource provides handy data shaping capabilities such as sorting and filtering.
The following example shows how to initialise TKDataSource with data and feed that data to TKListView.
Populating with data using TKListViewDataSource protocol
Alternatively TKListView may be populated with data by manually implementing several methods from the TKListViewDataSource protocol. This way requires a bit more code but gives more flexibility. First we need to set the datasource property of TKListView to a class adopting the TKListViewDatasource protocol. In the sample code bellow it is our view controller.