gpt4 book ai didi

iOS 绑定(bind) : How to create a binding for a class that implements several delegates?

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:40:25 26 4
gpt4 key购买 nike

我正在尝试制作一个绑定(bind)项目,但我不知道如何绑定(bind)下一个接口(interface),它实现了三个不同的委托(delegate):

@interface Integration :  NSObject<NSURLConnectionDelegate, SomeControllerDelegate, 
CLLocationManagerDelegate>
{
id<VendorIntegrationDelegate> delegate;
Information *Information;
SomeController * controller;
}

@property(nonatomic,assign) id<VendorIntegrationDelegate> delegate;
@property(nonatomic,strong) Information *Information;
@property(nonatomic,strong) SomeController *controller;

@end

在 ApiDefinition.cs 中我做了如下绑定(bind),缺少 SomeControllerDelegate 和 CLLocationManagerDelegate 的实现:

[BaseType (typeof (NSUrlConnectionDelegate), Delegates=new string [] { "WeakDelegate" },
Events=new Type [] { typeof (VendorIntegrationDelegate)})]
public partial interface Integration
{
[Export ("delegate", ArgumentSemantic.Assign), NullAllowed]
NSObject WeakDelegate { get; set; }

[Wrap("WeakDelegate")]
VendorIntegrationDelegate Delegate { get; set; }

[Export ("Information", ArgumentSemantic.Retain)]
Information Information { get; set; }

[Export ("controller", ArgumentSemantic.Retain)]
SomeController Controller { get; set; }

}

我在做这个绑定(bind)时发现的问题是接口(interface)继承了几个类,如何创建这个绑定(bind)

最佳答案

如果问题是关于 SomeControllerDelegate 的,您可以将其声明为 [Model] 并且不使用 [BaseType],如下所示:

[Model]
interface SomeControllerDelegate
{
//...
}

//...

[BaseType (typeof (NSUrlConnectionDelegate), /*...*/]
interface Integration : SomecontrollerDelegate
{
...
}

关于iOS 绑定(bind) : How to create a binding for a class that implements several delegates?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18927096/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com