我有一个SpriteKit场景,我想在表的每一行中显示进度环。但是,该场景不可见。我已经在表外尝试过它,因此我知道RingScene可以正常工作,但是无法在表行中显示它。该行有一个组,但是它们的颜色很清晰,因此我认为它们不会使它模糊。我的代码是:谢谢您的建议。
import WatchKit
import Foundation
class DevicesController: WKInterfaceController {
@IBOutlet var deviceTable: WKInterfaceTable!
// for ring
var scene: RingScene!
override func awake(withContext context: Any?) {
super.awake(withContext: context)
refreshTable()
}
func refreshTable() {
deviceTable.setNumberOfRows(1, withRowType: "DevicesRowType")
for index in 0..<deviceTable.numberOfRows {
if let controller = deviceTable.rowController(at: index) as? DevicesRC {
controller.rowNumber = index
controller.delegate = self
// SceneKit
scene = RingScene(size: contentFrame.size)
controller.skInterface.presentScene(scene)
}
}
}
并且行控制器是:
import WatchKit
protocol DeviceRowDelegate {
func rowSettingsButtonConnect(atIndex: Int)
func rowSettingsButtonDisconnect(atIndex: Int)
func rowSwitch(atIndex: Int)
}
class DevicesRC: NSObject {
@IBOutlet var skInterface: WKInterfaceSKScene!
}