How can I reload the data in a WatchKit tableview? How can I reload the data in a WatchKit tableview? ios ios

How can I reload the data in a WatchKit tableview?


In the link @leolobato posted, there is actually a workaround. It did solve my problem.

https://devforums.apple.com/message/1098875#1098875

when you change your rows just set them to =@"" first.

For example, if your row has a row.Label and you are changing it, do row.Label.text = @"" then again right after row.Label.text =@"[Actual text]"


Calling the setRowTypes: or setNumberOfRows:withRowType: method.

Below is a statement from the developer document, I believe this will work.

When you want to update the contents of a table, call setRowTypes: or setNumberOfRows:withRowType: again with the new row type information. Calling these methods again forces the table to discard the old rows and create new ones. To insert new rows without removing the old ones, use the insertRowsAtIndexes:withRowType: method.

Link to document


I've discovered that calling setNumberOfRows:rowType does not refresh the table unless you call it from the willActivate method. I had a delegate method that I was calling from a modal controller which would fetch a new set of records from the parent app and then reload the table. Even though printing out numberOfRows showed the new number of rows that I set, visually the existing rows were still displayed on screen. It was only after I set a flag in my delegate method and then in willActivate checked that flag and only then reloaded the table, did it refresh the display.