[英]How do I show a third button when I press on two buttons in Swift?
I have these two buttons and when I press one button and I press another button I want a third button to appear. 我有这两个按钮,当我按下一个按钮又按下另一个按钮时,我希望出现第三个按钮。 The code I have currently will show the third button when i press on one button.
当我按下一个按钮时,我当前拥有的代码将显示第三个按钮。 What I need is to show the third button when both buttons are pressed.
我需要的是在同时按下两个按钮时显示第三个按钮。 How would I do that?
我该怎么做?
//EDIT CODE
if node.name == "firstButton" {
if firstButtonClicked {
thirdButton.hidden = false
firstButtonClicked = true
}
}
if node.name == "secondButton" {
if secondButtonClicked {
thirdButton.hidden = false
secondButtonClicked = true
}
var firstClicked = fasle
var secondClicked = false
if node.name == "firstButton" {
firstClicked = true
if secondClicked {
thirdButton.hidden = false
}
}
if node.name == "secondButton" {
secondClicked = true
if firstClicked {
thirdButton.hidden = false
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.