Two tables in a watchApp scene?

I would like to have two WKInterfaceTables running independently in a watch scene, but am not having any joy implementing them.

I have created the two tables in a Group which works fine, now that I have played areound wuth Groups.


The complication (excuse the pun) occurs in table(_ table: WKInterfaceTable, didSelectRowAt rowIndex: Int)

where I can't work out which table has been selected. It gets called when I select either table, but tI can't identify which table was selected.

Answered by PBK in 318175022

In the .h file you should have these two lines


@property (weak, nonatomic) IBOutlet WKInterfaceTable *myFirstTable;
@property (weak, nonatomic) IBOutlet WKInterfaceTable *mySecondTable;


In the .storyboard file you should connect each table to one of those two IBOutlets. Then in the method

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

you examine the value of "table" to see which table it is:

  if([table isEqual:myFirstTable]){........}


.

Accepted Answer

In the .h file you should have these two lines


@property (weak, nonatomic) IBOutlet WKInterfaceTable *myFirstTable;
@property (weak, nonatomic) IBOutlet WKInterfaceTable *mySecondTable;


In the .storyboard file you should connect each table to one of those two IBOutlets. Then in the method

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

you examine the value of "table" to see which table it is:

  if([table isEqual:myFirstTable]){........}


.

Thanks. (reply in ObjC, easily converted to Swift)

The answer is sooo obvious when you see it, but to an experienced but Apple newbie... not so!

Two tables in a watchApp scene?
 
 
Q