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:
Scroll further:
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
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With