来自UIActionSheet的调用函数

时间:2011-01-25 11:15:04

标签: iphone 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

我不明白发生了什么。如果我在我的(void)actionSheet函数中复制/粘贴sendMail函数中的内容,它就像魅力一样。所以看起来sendMail函数的调用是问题,我不明白为什么。

谢谢!

1 个答案:

答案 0 :(得分:1)

Objective-C调用方法而不是函数,它是这样的:

[self sendMail];