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 #16

Closed
jolo2000 opened this issue Jan 2, 2012 · 1 comment
Closed

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

jolo2000 opened this issue Jan 2, 2012 · 1 comment

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

@epreston
Copy link
Owner

epreston commented Jan 2, 2012

It seems the system added this issue twice. I am closing this one as a duplicate of #15.

See: #15

@epreston epreston closed this as completed Jan 2, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants