【发布时间】:2011-07-28 09:24:03
【问题描述】:
我想用 CFTree 创建一个像 NSArray 这样的树类。 (实际上 NSTree 并不存在,所以我正在尝试制作 'NSTree like tree'。)
但 CFTree 似乎要求某些类型类。 我想做一个通用类,可以处理像 NSArray 这样的各种类。
这是 iPhone 开发网站的示例。
static CFTreeRef CreateMyTree(CFAllocatorRef allocator) {
MyTreeInfo *info;
CFTreeContext ctx;
info = CFAllocatorAllocate(allocator, sizeof(MyTreeInfo), 0);
info->address = 0;
info->symbol = NULL;
info->countCurrent = 0;
info->countTotal = 0;
ctx.version = 0;
ctx.info = info;
ctx.retain = AllocTreeInfo;
ctx.release = FreeTreeInfo;
ctx.copyDescription = NULL;
return CFTreeCreate(allocator, &ctx);
}
我想使用通用类而不是“MyTreeInfo”。 有什么办法吗?
谢谢。
【问题讨论】:
标签: iphone objective-c ios core-foundation