简体   繁体   English

在Swift中按下两个按钮时,如何显示第三个按钮?

[英]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.

相关问题 如何在Swift中按下按钮来增加标签值 - How do I increment a label value with a button press in Swift 按下完成按钮时如何添加标记? - How do I add a marker when I press the done button? 快速地,如何检测印刷机何时开始和结束UILabel? - In swift, how do I detect when a press begins and end on a UILabel? 在 swift 中,当不同的按钮通向同一个 ViewController 时,我如何知道按下了哪个按钮? - How do I know in swift which button was pressed when different buttons lead to the same ViewController? 当我按下两个 UIButton 时,如何更改它们的颜色? - How do I change the color of two UIButtons when I press them? 点击UILabel(Swift)时如何显示UIPickerView? - How do I show a UIPickerView when tapping a UILabel (Swift)? 为什么当我在JSQMessagesViewController中按下发送按钮时出现2条消息 - Why do 2 messages appear when I press the send button in JSQMessagesViewController 单击按钮时如何更改按钮的文本? -迅捷 - How do I change the text of a button when it is clicked? - Swift 如何点击时更改按钮的图像 - Swift - How do I change the image of a button when tapped - Swift 当我按下按钮时如何更改UITableView的内容 - How i can change the content of a UITableView when i press a button
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM