Search code examples
ioswatchkit

How to change initial controller in WatchKit app?


In my WatchKit app I need to display one of two interface controllers depending on the state of the containing iOS app. Neither Page-Based nor Hierarchical interfaces suit my needs.

In UIKit I can change rootViewController of the window. Can I do similar trick in the WatchKit?

Is there a way to programmatically switch to a different interface controller without animation and make it the "initial controller"?


Solution

  • If there are only 2 Interface Controllers in your app, then you can use Groups, and show one group at a time, and hide other based on your conditions.

    At run-time, the only way to modify the arrangement of items is to show/hide elements that you already added using interface builder.

    Hope this helped.