在 OS X sierra 10.12 中,拖放不能与 NSTabView 一起正常工作。拖放似乎只适用于 TabView 的标签而不是整个选项卡..您可以在以下项目示例中看到...下载代码 或在这里是代码:-我已经创建了NSTabView的子类 AppMainTabSet 并在 Interface Builder 中将此类用作 TabView 的自定义类.....
#import "AppMainTabSet.h"
@implementation AppMainTabSet
- (id)initWithCoder:(NSCoder *)coder
{
/*------------------------------------------------------
Init method called for Interface Builder objects
--------------------------------------------------------*/
self=[super initWithCoder:coder];
if ( self ) {
}
return self;
}
- (void)awakeFromNib{
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
}
-(NSDragOperation) draggingEntered:(id < NSDraggingInfo >)sender
{
NSLog(@"Hello Hello....draggingEntered");
return NSDragOperationGeneric;
}
- (void)draggingExited:(id <NSDraggingInfo>)sender {
NSLog(@"**** draggingExited*****");
}
- (BOOL) prepareForDragOperation:(id <NSDraggingInfo>)sender {
NSLog(@"Hello Hello....prepareForDragOperation");
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSLog(@"Hello Hello....performDragOperation");
return YES;
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender {
NSLog(@"Hello Hello....concludeDragOperation");
[[NSCursor arrowCursor] push];
[self setNeedsDisplay:YES];
}
- (BOOL) processNSDraggingInfo:(id <NSDraggingInfo>)sender {
NSLog(@"Hello Hello....processNSDraggingInfo");
return YES;
}