我想从CFArrayRef
中删除windowIdCFArrayRef window2ids = CGWindowListCreate(kCGWindowListOptionOnScreenOnly ,
kCGNullWindowID);
这可能吗?如果是这样的话?我用谷歌搜索,但我没有找到任何答案。
答案 0 :(得分:1)
CFArrayRef window2ids = CGWindowListCreate(kCGWindowListOptionOnScreenOnly ,
kCGNullWindowID);
NSMutableArray *mutArray = [NSMutableArray arrayWithArray:(__bridge_transfer NSMutableArray *)window2ids];
id windowIamLookingFor;
[mutArray indexOfObject:windowIamLookingFor];
[mutArray removeObject:yourWindowId];
CFArrayRef window3ids = (__bridge CFArrayRef)[mutArray copy];
或做corefoundation舞蹈
CFArrayRef window2ids = CGWindowListCreate(kCGWindowListOptionOnScreenOnly ,
kCGNullWindowID);
CFMutableArrayRef mutWindowsIds = CFArrayCreateMutableCopy(NULL, 0, window2ids);
CFRelease(window2ids);
id windowIamLookingFor;
CFIndex index = CFArrayGetFirstIndexOfValue(mutWindowsIds, CFRangeMake(0, CFArrayGetCount(window2ids)), (__bridge const void *)(windowIamLookingFor));
CFArrayRemoveValueAtIndex(mutWindowsIds, index);
CFRelease(mutWindowsIds);