The InnerNativeSymbolSetHandle used above to pass into the C functions was a property I bound on the ZBarSymbolSet class as luckily the ZBar iPhone SDK authors exposed pointers to the underlying structs from the C ZBar library:// @interface ZBarSymbolSet : NSObject <NSFastEnumeration>[BaseType (typeof(NSObject))]interface ZBarSymbolSet{ // @property (readonly, nonatomic) int count; [Export("count")] int Count { get; } // @property (readonly, nonatomic) const zbar_symbol_set_t *zbarSymbolSet; [Export("zbarSymbolSet")] IntPtr InnerNativeSymbolSetHandle{ get; } // @property (nonatomic) BOOL filterSymbols; [Export("filterSymbols")] bool FilterEnabled { get; set; }}所以这是手动解决方案.我仍然希望 btouch 有一种自动方式来做到这一点(显然不是通过这些 C 函数,而是通过挂钩到 NSFastEnumeration 协议的 countByEnumerationWithState 函数.如果目标-c 可以使用objective-c for 循环以通用方式完成,那么MonoTouch 肯定也可以自动挂钩吗?So this is the manual solution.I am still hoping there is an automatic way for btouch to do this (obviously not via these C functions, but via hooking into the countByEnumeratingWithState function of the NSFastEnumeration protocol. If objective-c can do it in a generic fashion using the objective-c for loop, then surely MonoTouch can automatically hook into it as well? 这篇关于将实现 NSFastEnumeration 协议的 Obj-C 类型绑定到 MonoTouch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-14 02:01