I just need to check which row was selected to pass data between WKInterfaceController
. Here is my code, but NSLog doesn't show anything:
- (void)loadTableData {
NSArray* items = [NSArray arrayWithObjects:@"cell 1 ",@"cell2 ", @"cell 3",@"cell4",nil];
// Configure the table object (self.todoItems) and get the row controllers.
[self.myTable setNumberOfRows:items.count withRowType:@"DinoNameRow"];
NSInteger rowCount = self.myTable.numberOfRows;
// Iterate over the rows and set the label for each one.
for (NSInteger i = 0; i < rowCount; i++) {
// Get the to-do item data.
NSString* itemText = items[i];
// Assign the text to the row's label.
DinoNameRow* row = [self.myTable rowControllerAtIndex:i];
[row.dinoName setText:itemText];
}
}
- (void)table:(WKInterfaceTable *)table didSelectRowAtIndex:(NSInteger)rowIndex {
switch (rowIndex) {
case 0:
NSLog(@"ROW 1");
break;
default:
break;
}
}
Make sure that...
WKInterfaceTable
is connected via IBOutlet to your Storyboard element.You have overridden the correct
WKInterfaceController
method: