Hide button in Swift 3

試著忘記壹切 提交于 2020-01-13 08:18:53

问题


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.

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.

I hope someone can help me out.


回答1:


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
}


来源:https://stackoverflow.com/questions/41230014/hide-button-in-swift-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!