Search code examples
watchkitapple-watchwatchos-2uipagecontrol

Hide UIPageControl dots on watchOS 2?


I am using watchOS 2 and my main view is made up of 3 WKInterfaceControllers which are navigated between using a standard UIPageControl. This is all great, however, when my watch app's data is loading, I show a loading animation on the main controller and I would like to hide the page control (as I don't want people swiping to navigate to a blank controller).

I found this discussion around coloring the dots not being possible, but I am simply looking to hide them entirely while loading (and then show them again), and ideally disable navigation at the same time.

Is this possible?


Solution

  • You can use reloadRootControllersWithNames to change the number of pages after your data is loaded.

    The downside is that the user would end up seeing a second spinner as a result of the pages being reloaded.

    From the user's perspective

    The best UX might be to leave the default behavior alone, and allow the user to always be able to swipe between pages.

    1. It saves time by letting the user preemptively navigate to the page they want to see.

    2. It eliminates any confusion resulting from the interface inconsistently being pageable.

    3. It removes any frustration over the app initially not being responsive.

    Since the user expects to be able to swipe between pages, allowing that behavior to happen reinforces that positive experience, even though your data may not be available yet.

    • Apple uses this approach and often resorts to showing previous data (from another time/day) until new data arrives and the UI gets refreshed.

    • Your app could alternately show placeholder data or a message.

    It also spares you from maintaining any fragile code that would break if Apple makes changes which affect your ability to hide or disable behaviors.