iOS Tutorial TableView with custom items

iTableView v1.20 adds support for custom items.

Each TableCell includes a CustomView property. You can set a Panel with views to this property and the panel will be added to the cell.

upload_2015-2-26_13-18-54.png


It is quite similar to CustomListView class. However TableView is more powerful.
Do note that when you create custom views your TableView will be limited to about 1000 items as each cell holds its own custom views (the standard cells are reused and therefore support any number of cells).

The attached example adds cells based on a designer layout file:
B4X:
For i = 1 To 50
     Dim tc As TableCell = tv.AddSingleLine("")
     tc.ShowSelection = False
     tc.CustomView = CreateItem
Next

Private Sub CreateItem As Panel
   Dim p As Panel
   p.Initialize("")
   p.Width = 100%x
   p.Height = tv.RowHeight
   p.LoadLayout("1")
   Return p
End Sub

You will usually want to explicitly set the RowHeight property before creating the items. The default value of this property is not useful for custom items.

The table cells are resized in the Page_Resize event. The TextField is anchored to both sides so it will fill the entire space when you rotate the device.
 

Attachments

  • TableViewWithCustomItems.zip
    4.2 KB · Views: 1,191

Daniel Uribe

Member
Licensed User
Hi Erel,

A little question, how can i erase the white line separator for each row?
? An example on the screenshot. i´m using the first post example.

Thanks a lot.!!
 

Attachments

  • img_prueba.jpg
    img_prueba.jpg
    121.3 KB · Views: 409
Top