Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Watch Table - first 4 rows not appearing

I'm having problems adding rows to WKInterfaceTable on Apple Watch. The weird thing is that no matter what I do, the first 4 rows appear as empty. I tried adding rows manually and in a loop - doesn't matter. I believe my code is good because 5th and further rows appear just fine. Here's what happens:

empty rows

Scroll further:

enter image description here

My code:

import Foundation
import WatchKit

class TableInterfaceController: WKInterfaceController{

    @IBOutlet weak var agentTable: WKInterfaceTable!

    let agents = ["The Dude","Walter","Donnie","Maude","Knox","Karl","Nihilist 2"]

    override init(){
        super.init()
        loadTableData()
    }


    private func loadTableData(){
        agentTable.setNumberOfRows(agents.count, withRowType: "AgentTableRowController")
        println("Count: \(agents.count)")

        for(index,agentName) in enumerate(agents){
            let row = agentTable.rowControllerAtIndex(index) as AgentTableRowController
            println(agentName, index)
            row.agentLabel.setText(agentName)
        }
    }
}

Any help appreciated. It's probably something trivial. I'm running Xcode 6.2 (6C131e) on Yosemite 10.10.2

like image 821
gh0st Avatar asked Mar 19 '15 14:03

gh0st


People also ask

What is Grid view on Apple Watch?

Grid view shows your app icons in a honeycomb layout that you can navigate with your finger. List view shows apps in alphabetical order which you can scroll through using the Digital Crown. We'll show you how to set your Apple Watch apps to list view or grid view, according to your preference.

How do I change the view on my Apple Watch?

Press the Digital Crown to go to the watch face. Touch and hold the display. Swipe left or right to choose a watch face, then tap Edit. Swipe left or right to select a feature, then turn the Digital Crown to change it.

What is the slot on my Apple Watch?

On earlier Apple Watch models, if you look inside the slot where the bottom band connects, there is a special port. It's not for consumer use but for diagnostic functions when the Watch is being serviced by Apple.


1 Answers

I was having the exact same issue when initializing my table in awakeWithContext. By moving my table initialization into willActivate as suggested by dan the issue was solved.

I sifted through the documentation of both WKInterfaceController and WKInterfaceTable and they suggest that you should be able to perform the initialization in init or awakeWithContext, so I believe this is a bug in the WatchKit framework.

like image 90
bengoesboom Avatar answered Nov 07 '22 02:11

bengoesboom