xcode Swift 3 中的隐藏按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41230014/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:39:55  来源:igfitidea点击:

Hide button in Swift 3

xcodebuttonswift3hide

提问by J. Aberson

I've just started with coding and I really want to know how to hide buttons.

我刚刚开始编码,我真的很想知道如何隐藏按钮。

What I want to do is when I press my button:

我想做的是当我按下按钮时:

Start:I want to let the start button and the back button disappear.

开始:我想让开始按钮和后退按钮消失。

It's done with Outlets and Actions.

它是通过 Outlets 和 Actions 完成的。

I already searched a bit but when I wanted to do it, it said that the dokeyword is expected to designate a block of statements.

我已经搜索了一点,但是当我想搜索时,它说do关键字应该指定一个语句块。

I hope someone can help me out.

我希望有人可以帮助我。

回答by TheValyreanGroup

Once you have your outlets connected, simply change the isHiddenproperty to true.

连接好插座后,只需将isHidden属性更改为 true。

IBOutlet weak var startButton: UIButton
IBOutlet weak var backButton: UIButton

IBAction func tapStart(sender: AnyObject?){
   self.startButton.isHidden = true
   self.backButton.isHidden = true
}