1

I am trying to create a table with sections having varying number of rows. I saw the solution given here How to create sections in WKInterfaceTable and tried it as follows:

tableView.setRowTypes(rowTypes);
for q in 0...rowTypes.count-1 {
    if (rowTypes[q] == "teamSection") {
        let row = tableView.rowControllerAtIndex(q) as? teamSection;
    }
    else {
        let row = tableView.rowControllerAtIndex(q) as? teamRow;
    }
}

I have my rowTypes as follows:

let rowTypes = ["teamSection", "teamRow", "teamSection", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow", "teamRow"];

I was expecting 11 rows but am only getting 9 which are all of the teamRow type and none of the teamSection. Can anyone spot what am doing wrong?

Community
  • 1
  • 1
Michael Woyo
  • 138
  • 2
  • 15

1 Answers1

0

It looks like teamSection isn't a valid row type. Are you sure you've set up the table in the storyboard with two rows and set the identifier correctly for one of them as "teamSection"?

gregheo
  • 4,182
  • 2
  • 23
  • 22
  • indeed `teamSection` wasn't a valid `rowType`. I didn't know I had to setup only a SINGLE table with 2 rows. I used 2 different tables and linked them to the same outlet. I have deleted one table and moved the row into the other and it worked. Thanks man. – Michael Woyo Mar 23 '15 at 03:43