我正在使用 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 上,我不知道如何“翻译”它。
有人可以帮助我吗?:)