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).
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];
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];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With