从 UIActionSheet 调用函数
我对 UIActionSheet 有一个愚蠢的问题。 我希望通过单击操作表的第一个按钮来启动我的功能“sendMail”。
所以这就是我所做的:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@"%d", buttonIndex);
if (buttonIndex == 0) {
sendMail();
}
}
我在 .h 文件中声明了我的函数 sendMail,它包含:
-(void)sendMail;
-(void)actionSheet;
当我想构建并运行时,出现以下错误:
Undefined symbols:
"_sendMail", referenced from:
-[my1ViewController actionSheet:clickedButtonAtIndex:] in my1ViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
我不明白发生了什么。如果我将 sendMail 函数中的内容复制/粘贴到 (void)actionSheet 函数中,它就会像魅力一样工作。所以看起来sendMail函数的调用是问题所在,我不明白为什么。
谢谢 !
I have a stupid problem with an UIActionSheet.
I want my function "sendMail" to be launched by clicking on the first button of my action sheet.
So here is what I did :
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@"%d", buttonIndex);
if (buttonIndex == 0) {
sendMail();
}
}
I declared my function sendMail in my .h file, it contains :
-(void)sendMail;
-(void)actionSheet;
When I want to build and run, I have the following error :
Undefined symbols:
"_sendMail", referenced from:
-[my1ViewController actionSheet:clickedButtonAtIndex:] in my1ViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I don't understand what is going on. If I copy/paste what's inside my sendMail function inside my (void)actionSheet function, it works like a charm. So it looks like the call of the sendMail function is the problem, and I don't understand why.
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Objective-C 调用方法而不是函数,如下所示:
Objective-C calls methods not functions and it's like this: