- (BOOL) imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex;
IKImageBrowserView
未调用此用于重新排序的数据源方法。笔尖连接正确。setAllowsReorderdering
设置为 YES。
但它还没有工作。
- (void)imageBrowser:(IKImageBrowserView *)aBrowser removeItemsAtIndexes:(NSIndexSet *)indexes
同时,上述删除项目的方法被正确调用并完美运行。为什么不重新排序?
当我拖动项目以重新排序时,正在调用以下拖放代码。这里实际上有 2 个 IKImageBrowserViews。
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPoint draggingLocation = [self convertPoint:[sender draggingLocation] fromView:nil];
NSRect contentRect = [[_indexContentBrowserView enclosingScrollView] frame];
BOOL isForContent = (contentRect.origin.x < draggingLocation.x) && (draggingLocation.x < contentRect.origin.x + contentRect.size.width);
if (isForContent)
{
if ([sender draggingSource] == _indexContentBrowserView)
{
return NSDragOperationMove;
}
else
{
NSPasteboard *pb = [sender draggingPasteboard];
NSString * type = [pb availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]];
if(type != nil)
{
return NSDragOperationEvery;
}
}
}
else
{
if ([sender draggingSource] == _indexListBrowserView)
{
return NSDragOperationMove;
}
else
{
NSPasteboard *pb = [sender draggingPasteboard];
NSString * type = [pb availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]];
if(type != nil)
{
return NSDragOperationEvery;
}
}
}
return NSDragOperationNone;
}