如何隱藏顯示/隱藏按鈕(編輯爲擴大在這裏)。即使我將它設置爲空字符串,數據單元的邊框也會縮小,如圖所示。以前我使用的方法- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item
,它隱藏顯示/隱藏字符串,並完美工作。但問題是outlineview只允許擴展而不是崩潰。我想通過單擊相應的父節點一次只擴展一個父節點。
1
A
回答
1
終於解決了吧,this code幫了我。
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)rowIndex
{
NSRect superFrame = [super frameOfOutlineCellAtRow:rowIndex];
// Return NSZeroRect if the row is a group row
if ([[self delegate] respondsToSelector:@selector(outlineView:isGroupItem:)]) {
if ([[self delegate] outlineView:self isGroupItem:[self itemAtRow:rowIndex]]) {
return NSZeroRect;
}
}
return superFrame;
}
+2
我爲您使用其他委託方法提供了更好的解決方案。否則,您的解決方案可能會在任何時候中斷,例如,如果剪切停止爲您隱藏單元格。 – Dalzhim
7
使用從NSOutlineViewDelegate方法此方法:
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(ID)項;
相關問題
- 1. 基於視圖隱藏/顯示元素
- 2. Eclipse大綱視圖隱藏代碼
- 3. 隱藏,顯示,隱藏/ SHOWALL按鈕
- 4. 顯示隱藏視圖
- 5. 顯示/隱藏視圖
- 6. 顯示/隱藏子視圖
- 7. 隱藏/顯示圖像按鈕JS
- 8. Docusign顯示/隱藏按鈕
- 9. 顯示/隱藏按鈕
- 10. 顯示/隱藏按鈕javascript
- 11. javascript顯示/隱藏按鈕
- 12. 顯示隱藏按鈕
- 13. 顯示/隱藏按鈕
- 14. sencha隱藏顯示按鈕
- 15. 顯示/隱藏按鈕2
- 16. 顯示隱藏立基於
- 17. 按鈕隱藏圖像
- 18. UIpopoverviewcontroller點擊按鈕隱藏父視圖
- 19. 如何根據按鈕點擊隱藏和顯示視圖?
- 20. 隱藏和顯示(子視圖)按鈕或更改標題?
- 21. iOS:UISplitViewController顯示/隱藏主視圖按鈕不起作用
- 22. 隱藏按鈕視圖,然後再次顯示
- 23. mvc - 基於用戶控件的視圖顯示/隱藏東西
- 24. 通過按鈕或單選按鈕顯示/隱藏圖像
- 25. 基於滾動顯示/隱藏基於Javascript的圖像
- 26. 隱藏和顯示圖像
- 27. Jquery-顯示/隱藏圖像
- 28. AngularJS顯示/隱藏圖像
- 29. 顯示/隱藏圖像DIV
- 30. paper.js隱藏/顯示圖層?
固定:此代碼幫助我(https://code.google.com/p/sequel-pro/source/browse/trunk/Source/SPFavoritesOutlineView.m?spec=svn4025&r=4025) – user23790