IOS:具有两个操作的 IBAction
在我的应用程序中,我有一个 ibaction,其中有 2 条不同的指令,其中有一个“if”,
if (i == 0) //do instruction set 1
if (i == 1) //do instruction set 2
// and everytime I push button i change from 0 to 1 or from 1 to 0
问题是,如果我重复按下此 IbAction 的按钮,它就无法正常工作,因为前一个 ibaction 未完成其指令集1
示例=按下按钮,它执行指令集1,如果我再次按下该按钮,它不应该工作,因为它没有完成其工作,并且我想等待指令集1结束以重复按下按钮。
你明白吗?
In my app I have an ibaction and inside it I have 2 different instruction with an "if"
if (i == 0) //do instruction set 1
if (i == 1) //do instruction set 2
// and everytime I push button i change from 0 to 1 or from 1 to 0
the problem is that if I repeatedly press the button of this IbAction it don't work fine because the previous ibaction didn't finish its instruction set1
example = press button, it execute instruction set 1, if I push another time the button it shouldn't work because it it didn't finish its work and I want to wait the end of instruction set 1 to repeat the push of button.
Do you understand?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的类中有
BOOL workInProgress
变量:Assuming you have
BOOL workInProgress
variable in your class:使用布尔值,在指令集开始时将其设置为 NO,然后返回 YES。如果该值为 NO,则不执行任何操作
use a bool value,set it to NO at the begining of your instruction set,and back to YES after.if the value is NO then don't do anythig