2011-01-25 77 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