Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modal Segue in WatchKit not calling contextForSegueWithIdentifier

Tags:

ios

watchkit

I have an InterfaceController with a table view. I created a segue from a cell of the tableview to another InterfaceController. If the segue type is "Push" contextForSegueWithIdentifier gets called. If the type is "Modal" contextForSegueWithIdentifier does not get called.

like image 413
Misha Avatar asked Feb 10 '23 16:02

Misha


2 Answers

Never mind. According to the documentation contextForSegueWithIdentifier only gets called on a Push Segue. I needed to use the

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

method of the tableview to call

-(void)presentControllerWithNames:(NSArray *)names contexts:(NSArray *)contexts
like image 118
Misha Avatar answered Feb 13 '23 07:02

Misha


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

- (id)contextForSegueWithIdentifier:(NSString *)segueIdentifier inTable:(WKInterfaceTable *)table rowIndex:(NSInteger)rowIndex {
    return yourObject;
}
like image 36
BalestraPatrick Avatar answered Feb 13 '23 07:02

BalestraPatrick