Search code examples
iosswiftwatchkitapple-watch

WKInterfaceTable scroll up to refresh


I have seen some Apps on my Watch with the "scroll up to refresh" feature, like the email app. If you scroll up when you are on the top, the content gets refreshed and a little wheel is shown on the top.

How is that done? I can't find anything in the documentation


Solution

  • I´ve only seen this on Apple-apps. So i guess they have a wider API. Anyway you can do a workaround. When you initialise your table you could use the

    - scrollToRowAtIndex:
    

    And specify row 1. This will now be your first row for your data. The row at index 0 will be a row with a button that will refresh the table. When you tap row 0 you could insert an WKInterfaceImage with an animation (or perhaps look for a way to do the spinning wheel yourself).

    This is not the optimal way, but if you play around a little bit with it you can make it work and make it look good. Hope this helps you.