作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试制作一个绑定(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/
我是一名优秀的程序员,十分优秀!