2011-12-22 32 views
0

我創建一個UIActionSheet和它的委託設置爲self這樣得到一個警告:創建UIActionSheet當編程

aac = [[UIActionSheet alloc] initWithTitle:@"בחר את הסיבה?" 
               delegate:self 
             cancelButtonTitle:nil 
            destructiveButtonTitle:nil 
             otherButtonTitles:nil]; 

一切工作正常。只是,我得到一個警告:

/Users/shimon_wi/Downloads/TabBarAndNavControllersDemo/Classes/avilability.m:66:63:{66:63-66:67}:警告:發送「avilability *'參數的不兼容類型'id<UIActionSheetDelegate>'

我不知道爲什麼。

回答

3

您是否聲明您的課程符合<UIActionSheetDelegate>協議?這是在類的頭做像這樣:

@interface MyViewController : UIViewController <UIActionSheetDelegate> 

如果你不這樣做,但你實現委託方法,那麼你的代碼將運行,但你會得到警告,這聽起來像你的情況。

+0

你是對的,謝謝 –

+0

如果答案已經解決了你的問題,那麼請點擊答案分數下的空白複選標記將其標記爲已接受。這讓人們知道問題得到了解答,併爲您提供更好的機會來回答您未來的問題。 – jrturton