如何在Objective-C中调用方法?
问题描述:
我刚开始在iOS和我试图让用户自定义函数...如何在Objective-C中调用方法?
我的代码:
-(void) testFunction{
//has self. calls
}
-(IBAction)button:(id)sender {
testFunction();
}
我得到警告:函数隐式声明是无效的C99
我在做什么错?或者我有什么要添加到我的代码?
答
在Objective-C中,你不能写testFunction()
。你发送'消息',你可以通过这样做
[self testFunction]
非常感谢你 – slowsword 2013-03-20 23:35:24