2012-02-28 15 views
3

私は次のもの(プロトコルとそのプロトコルを使用するインターフェイス)を持っていれば、btouchのApiDefinitionを設定する正しい方法は何ですか?私は変換された.hファイルのほとんどを持っているが、これは私を騙している。あなたはどちらか、単にあなたのクラスに直接プロパティをインライン化することができ、またはあなたは発電機があなたのためにそれらをインライン持つことができるようにモノトゥッチのバインディング構文プロトコルの場合

おかげ

ジェフ

@protocol GRGrabbaPreferencesProtocol <NSObject> 
- (NSString*) baseNamepace; 
@end 

@interface GRGrabbaPreferences : NSObject <GRGrabbaPreferencesProtocol> 
{ 
    GRGrabbaBarcodePrefs *barcode; 
} 
@property (retain) GRGrabbaBarcodePrefs *barcode; 
@end 

@interface GRGrabbaBarcodePrefs : NSObject <GRGrabbaPreferencesProtocol> 
@end 

答えて

4

プロトコルは本当にただ、あなたのインターフェースにインライン化されています。

// Notice the lack of [BaseType] attribute on this one 
interface GRGrabbaPreferencesProtocol { 
    [Export ("baseName")] 
    string BaseName { get; } 
} 

[BaseType (typeof (NSObject))] 
interface GRGrabbaPreferences : GRGrabbaPreferencesProtocol { 
    [Export ("barcode")] 
    GRGrabbaBarcodePrefs Barcode { get; } 
} 

[BaseType (typeof (NSObject))] 
interface GRGrabbaBarcodePrefs : GRGrabbaPreferencesProtocol { 
} 

上記は同じです:

[BaseType (typeof (NSObject))] 
interface GRGrabbaPreferences : GRGrabbaPreferencesProtocol { 
    [Export ("baseName")] 
    string BaseName { get; } 

    [Export ("barcode")] 
    GRGrabbaBarcodePrefs Barcode { get; } 
} 

[BaseType (typeof (NSObject))] 
interface GRGrabbaBarcodePrefs : GRGrabbaPreferencesProtocol { 
    [Export ("baseName")] 
    string BaseName { get; } 
} 

発電機がエラーと、カット/ペーストの問題を回避するためにインライン展開を引き継ぐようにするより実用的です。しかし、GRGrabbaPreferencesProtocolはどの形式でもC#にエクスポートされません。

関連する問題