Reputation: 8548
I'm trying to push an interface controller with the identifier "InterfaceControllerTodoItemTapped" programmatically (deployment target iOS 8.2) when a WKInterfaceTable row is tapped:
[self pushControllerWithName:@"InterfaceControllerTodoItemTapped" context:nil];
The source controller is part of a page-based navigation setup.
The identifier field of the receiving interface controller is set to "InterfaceControllerTodoItemTapped".
Problem: Although the above push command is reached (confirmed using a breakpoint), the InterfaceControllerTodoItemTapped is not shown and its method awakeWithContext is not being called (confirmed using a breakpoint).
Upvotes: 5
Views: 2861
Reputation: 2201
For Swift 5+ Versions
self.pushController(withName: "SecondWKVC", context: nil)
Upvotes: 0
Reputation: 1796
If the Interface Controller you are pushing is hierarchical navigation then make sure -
Identifier field in Attributes Inspector is set.
[self pushControllerWithName:@"SSWatchTableInterfaceController" context:nil];
Upvotes: 6
Reputation: 8548
Apple's documentation states that one has to choose either a page-based or a hierarchical navigation. They are mutually exclusive.
Therefore, presenting a controller using pushControllerWithName does not work with page-based navigation.
The solution is to present the controller modally using the following method:
[self presentControllerWithName:@"InterfaceControllerTodoItemTapped" context:nil];
Upvotes: 14