-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Description
What would be the best way to have a toggle function so you can change the colour of the tag when you select, deselect it?
#define selectedColor [UIColor colorWithRed: 255.0/255.0 green: 128.0/255.0 blue: 0 alpha: 1.0]
#define deselectedColor [UIColor colorWithRed: 255.0/255.0 green: 0 blue: 0 alpha: 1.0]
From your demo in the viewDidLoad
I've amended the block
[self.tagListView addTagsAccordingToDataSourceArray:@[@"from", @"array", @"too"] withOnTapForEach:^(TagView *tagView) {
if ([tagView.backgroundColor isEqual:selectedColor]) {
tagView.backgroundColor = deselectedColor;
} else {
tagView.backgroundColor = selectedColor;
}
}
The background colour is set in IB but when compared it doesn't match.
If I add to viewDidLoad
self.tagListView.tagBackgroundColor = selectedColor;
it works.