1

良い一日、

(ObjectiveC) のバインディングを作成しようとしています

@interface GPUImageView : UIView <GPUImageInput>
{
    GPUImageRotationMode inputRotation;
}

これを ApiDefinitions.cs (MonoTouch) に記述して

[BaseType (typeof(UIView))]
interface GPUImageView : GPUImageInput{
    [Export ("initWithFrame:")]
    IntPtr Constructor(RectangleF frame);

    [Export ("autoresizingMask")]
    UIViewAutoresizing AutoResizingMask { get; set;}

    [Export ("addSubView:")]
    void AddSubView(UIView view);
}

そして、私が呼び出すと「InvalidCastException」が発生します

GPUImage.GPUImageView filterView = (GPUImage.GPUImageView)this.View;

リフレクションを使用するコンストラクターを作成できます。しかし、それは本当に正しい方法ですか?

乾杯!

4

1 に答える 1

1

Rolf Bjarne Kvinge が指摘したように、解決策は Interface Builder のクラス タイプを GPUImageView に変更することでした。これにより、UIView を継承する GPImageView を継承するクラスが作成されます。AddSubview をバインドする必要もありません。

于 2012-06-05T17:52:46.577 に答える