Modal Segue in WatchKit not calling contextForSegueWithIdentifier

I have an InterfaceController with a table view. I created a segue from a table cell in another InterfaceController. If the segue type is "Push" contextForSegueWithIdentifier is called. If the type is Modal, contextForSegueWithIdentifier is not called.

+4
source share
2 answers

Nothing. According to the documentation, contextForSegueWithIdentifier is only called in the Push Segue. I needed to use

- (void)table:(WKInterfaceTable *)table didSelectRowAtIndex:(NSInteger)rowIndex

tableview method to call

-(void)presentControllerWithNames:(NSArray *)names contexts:(NSArray *)contexts
+6
source

When using a table view, use this segue method to pass an object to your segment.

- (id)contextForSegueWithIdentifier:(NSString *)segueIdentifier inTable:(WKInterfaceTable *)table rowIndex:(NSInteger)rowIndex {
    return yourObject;
}
+2
source

All Articles