Xamarin绑定类

时间:2013-03-21 10:02:52

标签: binding delegates scrollview xamarin

我正在使用Xamarin为iOS开发应用程序。

在我的解决方案中,我添加了一个绑定项目以包含一些本机库,但是我在编写ApiDefinition.cs时遇到了一些麻烦

这是原始图书馆:

@class AccordionView;
@protocol AccordionViewDelegate <NSObject>
@optional
- (void)accordion:(AccordionView *)accordion didChangeSelection:(NSIndexSet *)selection;
- (void)accordion:(AccordionView *)accordion heightUpdate:(NSInteger)height;
@end

@interface AccordionView : UIView <UIScrollViewDelegate> {
[..]
}

- (void)addHeader:(id)aHeader withView:(id)aView setBool:(BOOL)arrow;
- (void)setOriginalSize:(CGSize)size forIndex:(NSUInteger)index;
- (void)scrollViewDidScroll:(UIScrollView *)aScrollView;
- (void)touchDown:(id)sender;

这就是我写ApiDefinitions.cs的方式

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

    [Export ("addHeader:withView:setBool:")]
    void AddHeader(NSObject aHeader, NSObject aView, bool arrow);

    [Export ("touchDown:")]
    void TouchDown(NSObject sender);

    [Export ("setOriginalSize:forIndex:")]
    void SetOriginalSize(SizeF size, uint index);

    [Export ("scrollViewDidScroll:")]
    void ScrollViewDidScroll(UIScrollView scrollView);
}

[BaseType (typeof(NSObject))]
[Model]
interface AccordionViewDelegate
{
    [Export ("accordion:didChangeSelection:")]
    void DidChangeSelection(AccordionView accordion, NSIndexSet selection);

    [Export ("accordion:heightUpdate:")]
    void HeightUpdate(AccordionView accordion, int height);
}

我的问题出现在UIScrollViewDelegate上,我不知道如何“翻译”它 有人可以帮帮我吗? :)

1 个答案:

答案 0 :(得分:0)