我可以在 ScheduledTimerWithTimeInterval 中传递 UIButton 吗?
在控制权返回给用户很久之后,我需要禁用按钮 2.56 秒。我使用以下代码,其中 theButton 是 UIButton 类型,在例程开头用
UIButton *theButton = sender;
定义稍后调用以下命令将更新标签,然后希望启用该按钮。更新标签工作正常,但在尝试启用按钮时崩溃,因此我必须错误地传递 UIButton。谁能给我举个例子/纠正我吗?
[NSTimer scheduledTimerWithTimeInterval:2.56
target:self
selector:@selector(updateLabel:)
userInfo:theButton
repeats:NO];
感谢您的帮助...
I need to disable a button for 2.56 seconds, long after control is returned to the user. I am using the following code where theButton is type UIButton, defined at the beginning of the routine with
UIButton *theButton = sender;
and later calling the following which will update a label and then, hopefully, enable the button. Updating the label works perfectly but it crashes when trying to enable the button so I must be passing the UIButton incorrectly. Can anyone give me an example / correct me on this?
[NSTimer scheduledTimerWithTimeInterval:2.56
target:self
selector:@selector(updateLabel:)
userInfo:theButton
repeats:NO];
Thanks for your help...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我希望您编写
updateLabel
: 方法如下谢谢,
I hope you are writing
updateLabel
: method as followsThanks,