2012-08-24 14 views
0

我學習拖放可可... 我無法從NSOutlineView拖行NSTableView放棄其對我來說很難.. 我曾嘗試以下方法。 。如何從NSOutlineView拖行NSTableView的

- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pasteboard proposedChildIndex:(NSInteger)index 
- (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(NSInteger)index 
- (BOOL)outlineView:(NSOutlineView *)outlineView acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)index 

但我不能執行darg和drop。

+0

您正在使用哪個版本的xcode? –

+0

我正在使用Xcode 4.2 – NewStack

回答

1

您還必須在目標表視圖上調用registerForDraggedTypes:以註冊tableview將接受哪些放置類型。

+0

拖放工作正常。現在我需要刪除'NSOutlineView'中的拖動行,請指導我解決這個問題... – NewStack

+0

刪除您的NSTreeController或您用來驅動NSOutlineView的其他數據源的行。如果使用綁定,綱要將自動更新,或者您必須執行-reloadData。 – diederikh

+0

我對'NSOutlineView'數據源使用'NSMutableArray'。我怎樣才能找到拖動的行...以及如何刪除...對不起,我是可可的新手.. – NewStack