4
我想用CFTree创建一个像NSArray一样的树类。 (其实NSTree不存在,所以我试图使'NSTree像树')。iphone - 用cftree创建树类
但CFTree似乎要求某些类型的类。 我想做一个普通的类,可以处理像NSArray的各种类。
这是iPhone dev网站的例子。
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”。 有什么办法吗?
谢谢。