本文介绍了按钮不工作的iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我插在IB一个按钮,添加在.h文件这个code
I inserted a button in IB, added this code in the .h file
-(IBAction)buttonPressed:(id)sender;
连接动作的按钮,IB(润色内),然后有这样的.m文件右下方@synthesize
Connected the action to the button in IB (Touch Up Inside) and then have this in the .m file right below @synthesize
-(IBAction)buttonPressed:(id)sender {
NSLog(@"Button pressed");
...
}
所以由于某些原因没有被执行的动作没有什么是示出了在控制台中。为什么是这样?谢谢你。
Nothing is showing up in the console so for some reason the action isn't being executed. Why is this? Thanks.
推荐答案
的方法似乎没什么问题。仔细检查:
The method appears fine to me. Double check that:
-
您已经在IB设置类视图控制器,它包含的按钮正确的类。
You've set in IB the class of your view controller that contains the button to the correct class.
当您在IB的按钮,右键点击它具有 IBAction为
勾搭上了。
When you right-click on the button in IB it has the IBAction
hooked up.
这篇关于按钮不工作的iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!