Created
June 12, 2010 18:51
-
-
Save BlairDuncan/435973 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)collapseItem:(id)anItem | |
{ | |
if (!anItem) | |
return; | |
var itemInfo = _itemInfosForItems[[anItem UID]]; | |
if (!itemInfo) | |
return; | |
if (!itemInfo.isExpanded) | |
return; | |
[self _noteItemWillCollapse:anItem]; | |
itemInfo.isExpanded = NO; | |
[self reloadItem:anItem reloadChildren:YES]; // this line and the next have been exchanged | |
[self _noteItemDidCollapse:anItem]; | |
} | |
- (void)expandItem:(id)anItem expandChildren:(BOOL)shouldExpandChildren | |
{ | |
var itemInfo = null; | |
if (!anItem) | |
itemInfo = _rootItemInfo; | |
else | |
itemInfo = _itemInfosForItems[[anItem UID]]; | |
if (!itemInfo) | |
return; | |
// to prevent items which are already expanded from firing notifications | |
if (!itemInfo.isExpanded) | |
{ | |
[self _noteItemWillExpand:anItem]; | |
itemInfo.isExpanded = YES; | |
[self reloadItem:anItem reloadChildren:YES]; // this line and the next have been exchanged | |
[self _noteItemDidExpand:anItem]; | |
} | |
if (shouldExpandChildren) | |
{ | |
var children = itemInfo.children, | |
childIndex = children.length; | |
while (childIndex--) | |
[self expandItem:children[childIndex] expandChildren:YES]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment