简体   繁体   English

当我点按1个UIButton swift时,停止所有UIButtons的工作

[英]Stop all UIButtons from working when I tap 1 UIButton swift

I want to make it so that when I tap a UIButton, the rest of buttons are disabled until I click a refresh button. 我想这样做,以便当我点击UIButton时,其余的按钮都被禁用,直到我单击刷新按钮为止。

I have 5 IBOutlets that I want to disable not including the refresh Button. 我有5个要禁用的IBOutlet,不包括刷新按钮。 Is there a function that stops the events that I can tie to the rest of the buttons? 是否有一个功能可以停止我可以绑定到其余按钮的事件? I don't even know where to start. 我什至不知道从哪里开始。

Thanks a lot in advance! 在此先多谢!

Connects a method (IBAction) to the button that must disable other. 将方法(IBAction)连接到必须禁用其他方法的按钮。 Within the method, for each button (connected in the GUI) type the follow line: 在方法中,对于每个按钮(在GUI中连接),键入以下行:

button.enabled = false

Hey so I got it to work! 嘿,所以我知道了! I did some more research and there's a duplicate of this post. 我做了更多研究,这篇文章重复了。 Everything is explained here: 一切都在这里说明:

Disable and Enable UIButton - XCode Swift 禁用和启用UIButton-XCode Swift

Thanks a lot anyways. 还是非常感谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM