我在尝试从一个View Controller到下一个View Controller获取几个变量时遇到很多问题。我该怎么做呢?这是我的下面的代码。这就是我希望能够发送变量视图控制器RedScoreW,并BlueScoreW到下一个窗口。我在问如何使用SWIFT语言(尤其是WATCHOS应用程序)执行此操作。
class InterfaceController2: WKInterfaceController {
var RedScoreW = 0
var BlueScoreW = 0
@IBOutlet var WatchRedScoreLabel: WKInterfaceLabel!
@IBOutlet var WatchBlueScoreLabel: WKInterfaceLabel!
@IBAction func RedScorePlus() {
if RedScoreW == 999 {
RedScoreW = 0
WatchRedScoreLabel.setText("0")
}else {
RedScoreW += 1
WatchRedScoreLabel.setText(String(RedScoreW))
}
}
@IBAction func RedScoreMinus() {
if RedScoreW == 0 {
RedScoreW = 999
WatchRedScoreLabel.setText("999")
}
else {
RedScoreW -= 1
WatchRedScoreLabel.setText(String(RedScoreW))
}
}
@IBAction func BlueScorePlus() {
if BlueScoreW == 999 {
BlueScoreW …Run Code Online (Sandbox Code Playgroud)