Continue to complete multiple-row types by adding code for generating a rowType array and reading it when creating a table.
- [Instructor] Now comes the one line…that ties everything together.…Instead of the number of rows,…use the setRowTypes method to set the row type on each cell.…This uses that string array we used earlier.…So we type in table.setRowTypes,…and we set this to rowTypes.…The count of this array becomes the number…of rows on the table, and each row itself…will get the row controller we specified up above.…
Now, once all this is set,…we can populate the table of content.…So, set another for loop, this time using index.…And you can do table numberOfRows,…which is a read-only property,…and then with that, I'll use another switch statement…and I'll take the row types to determine…what I'm going to do.…
And so, first one is the photo row controller,…so I'll do case PhotoRowController,…and then I'll do a case RowController,…and I'll do a default.…Now, once I've done that, I can go into each one of these,…and let the row for the photoRowController…equal table.rowController like we did for the single one,…and then it's at index, like we did before,…
- Principles of watchOS development
- Adding buttons and labels to your app
- Connecting objects to code
- Testing a watchOS app
- Laying out WatchKit UI objects
- Adding navigation
- Using Interface Library elements such as inputs, pickers, and media players
- Creating tables
- Working with table data
Skill Level Intermediate
1. A Look at the Apple Watch App
2. Building Your First Apple Watch App
3. Working with UI in watchOS
5. Interface Library
6. Tables and Scrolling
Next steps1m 57s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.