2011-01-25 78 views
0

我有一个UIActionSheet的愚蠢问题。 我希望通过点击我的操作表的第一个按钮来启动我的函数“sendMail”。来自UIActionSheet的调用函数

因此,这里是我做过什么:

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ 
    NSLog(@"%d", buttonIndex); 
    if (buttonIndex == 0) { 
     sendMail(); 
    } 
} 

我声明我的函数的Sendmail在我的.h文件,它包含:

-(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

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

[self sendMail]; 
+0

非常感谢! :) – 2011-01-25 11:23:05