0

I'm using a WKInterfaceTable on WatchOS.

If for example the table already has 5 rows,

and I

.setNumberOfRows(2, withRowType: "rows") so that it now only has 2 rows,

does that mean that the 3 rows that are no longer visible are deallocated

(or do I have to run apptTable.removeRows to de-allocate)?

Thanks

SudoPlz
  • 20,996
  • 12
  • 82
  • 123
  • I'm asking because https://developer.apple.com/documentation/watchkit/wkinterfacetable/1615832-setnumberofrows?language=objc is not very explicit about this point. – SudoPlz Dec 15 '17 at 19:10
  • @DávidPásztor if you're 100% certain, just post an answer and I'll accept it. – SudoPlz Dec 19 '17 at 17:09

1 Answers1

0

After you call .setNumberOfRows, the WKInterfaceTable will be updated, so yes, the extra 3 rows in your example will be removed. There's no need to manually call removeRows.

This is explicitly stated in the documentation as well:

Use this method when you want to populate a table with rows that are all of the same type. This method removes any existing rows from the table and configures a new set of rows based on the information in the numberOfRows and rowType parameters.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116