Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pushControllerWithName not working

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).

like image 384
vomako Avatar asked May 03 '15 08:05

vomako


2 Answers

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];
like image 182
vomako Avatar answered Sep 28 '22 15:09

vomako


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];

enter image description here

like image 31
San Avatar answered Sep 28 '22 17:09

San