Swift 3中的“隐藏"按钮 [英] Hide button in Swift 3

查看:323
本文介绍了Swift 3中的“隐藏"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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

我希望有人能帮助我.

推荐答案

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

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

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

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

这篇关于Swift 3中的“隐藏"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆