WKInterfaceTableCell
我在情节提要中创建了一个从一个到另一个WKInterfaceController
(称为DetailInterfaceController
)的推送序列 。
当我点击该行时, didSelectRowAtIndex
没有被调用。
有谁知道我哪里出错了,以及如何传递字符串?
表接口控制器
didSelectRowAtIndexPath
print
不调用语句
@IBOutlet var table: WKInterfaceTable!
var objectsArray = ["1","2","3"]
var object: String!
override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
self.object = self.objectsArray[rowIndex]
print(" object title: \(self.object)")
}
override func contextForSegueWithIdentifier(segueIdentifier: String) -> AnyObject? {
// You may want to set the context's identifier in Interface Builder and check it here to make sure you're returning data at the proper times
// Return data to be accessed in ResultsController
return self.object
}
详细信息接口控制器
未设置标签
@IBOutlet var label: WKInterfaceLabel!
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
// Make sure data was passed properly and update the label accordingly
if let val: String = context as? String {
self.label.setText(val)
} else {
self.label.setText("")
}
// Configure interface objects here.
}