2

I'm making watch app for iOS application. I get data from parent application in watch main InterfaceController and pass it to other InterfaceController for creating table. Here code of configuring table:

- (void)configureTableWithData:(NSArray*)dataObjects {

    [self.table setNumberOfRows:[dataObjects count] withRowType:@"rowType"];
    for (NSInteger i = 0; i < self.table.numberOfRows; i++) {

        RowType* row = [self.table rowControllerAtIndex:i];
        NSObject* object = [dataObjects objectAtIndex:i];

        [row.titleName setText:[object valueForKey:@"CharCode"]];
        [row.bottomValue setText:[object valueForKey:@"Value"]];
    }
}

When I select row, I want to transfer data back to first page. It's need for changing some label on first page. I'm doing it with transfer data to parent app and return it back to main InterfaceController

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

     //Here must be dictionary, where I put row

     [WKInterfaceController openParentApplication:data reply:^(NSDictionary *replyInfo, NSError *error) {
          NSLog(@"data transfer");
     }];

     [self dismissController];
}

How can I get data of row? (row.titleName, row.value) May be it's stupid question, I am still just a beginner, but I can get it. I tried to print on console row.titleName and row.bottomValue and of course I've get nothing. (sorry for my english, not my mother tongue) What did I miss?

Chirag Shah
  • 3,034
  • 1
  • 30
  • 61
mr.gray
  • 53
  • 6

1 Answers1

3

I have same issue with watch kit in tableview. For now we only set the text in cell label not get back so you have to do like this

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

     //Here must be dictionary, where I put row
     NSDictionary* object = [dataObjects objectAtIndex:rowIndex];
     NSLog("used object as you want");

     [WKInterfaceController openParentApplication:object reply:^(NSDictionary *replyInfo, NSError *error) {
          NSLog(@"data transfer");
     }];

     [self dismissController];
}
Chirag Shah
  • 3,034
  • 1
  • 30
  • 61