Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Tip: toggle expand/collapse button with different icons #15

Open
jolo2000 opened this issue Jan 2, 2012 · 0 comments
Open

Tip: toggle expand/collapse button with different icons #15

jolo2000 opened this issue Jan 2, 2012 · 0 comments

Comments

@jolo2000
Copy link

jolo2000 commented Jan 2, 2012

Hello,

this is just a little info.
If you want that the expand/collapse button of the provided example app shows the according icon of the tree state (collapsed/expanded), then you can achieve this behaviour with this code snippet.
Just connect the IBAction "toggleUIButtonImage" with the "Touch up inside" event in the IB of your xxxleaf.xib.

-(IBAction) toggleUIButtonImage:(id)sender{
if ([sender isSelected]) {
[sender setImage:[UIImage imageNamed:@"TreeViewSubtreeCollapsedButton.png"] forState:UIControlStateNormal];
[sender setSelected:NO];
}else {
[sender setImage:[UIImage imageNamed:@"TreeViewSubtreeExpandedButton.png"] forState:UIControlStateSelected];
[sender setSelected:YES];

}

}

HTH Johannes

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant