iOSCustomTableCell - changing values to label in cell

  1. 11 months ago

    Hi. I am working off the custom table cell example (Examples/iOS/Controls/Table/CustomCellsAndScroll). In the custom table cell, I have two buttons (+ and -) and a label that will display a value. In the buttons, the code simply looks like this

    theCount = theCount + 1 // or minus 1 for the minus button
    lblCount.Text = theCount.ToText

    This works well in the cell, but I am noticing that when I scroll down in the table, some of the other custom cells also have a value, but I didn't change them, only a few at the top. Is this not the appropriate way to do this?

    What I am working on is a simple inventory app that will have various items listed in the table, a label with the item count, and the +/- buttons to change the values. Will be saved/loaded from an iOSSQLite table

  2. Paul L

    11 Aug 2017 Xojo Inc
    Edited 11 months ago

    The cell instances can be (and usually are) re-used when there is more than a page or so of rows. You'll have to save state another way rather than using the cell instances themselves.$custom-cell-data

  3. Thanks Paul. I had a feeling that's what the issue was. I'm going to play around with this and see if I have any success

or Sign Up to reply!