2012-10-26 75 views
2

我在我們的項目中使用單元綁定包含了一些來自「Cocoa Controls」的控件,它們都工作正常,除了有一個我不能工作,我希望有人能夠發現一個明顯的錯誤。單點目標C綁定

這裏是客觀的C頭

typedef enum { 
kWTShort = 1, 
kWTLong = 5 
} WToastLength; 

@interface WToast : UIView 

+ (void)showWithText:(NSString *)text; 
+ (void)showWithImage:(UIImage *)image; 


+ (void)showWithText:(NSString *)text length:(WToastLength)length textColor:(UIColor *) textColor backgroundColor:(UIColor *) backGroundColor; 
+ (void)showWithImage:(UIImage *)image length:(WToastLength)length; 



@end 

,這裏是單聲道ApiDefinition

[BaseType (typeof(UIView))] 
interface WToast 
{ 
     [Export("showWithText:")] 
     void ShowText(String text); 


    [Export("showWithText:length:textColor:backgroundColor:")] 
    void ShowText(string text,ToastLenght lenght,UIColor textColor,UIColor backgroundColor); 
} 

注意到我沒有將枚舉ToastLength

任何方式對象實例化,但是當我調用ShowText程序不能找到選擇器[WToast showWithText:]

我希望有人能幫助

關於基督教Stœr安徒生

回答

3

我想我只是需要步行從代碼走了位。

的回答是,我有點厚

你會發現目標c函數是

+ (void)showWithText:(NSString *)text; 

- (void)showWithText:(NSString *)text; 

那裏爲單定義應該是

[Static,Export("showWithText:")] 
    void ShowText(String text); 

[Export("showWithText:")] 
    void ShowText(String text); 

感謝所有