Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter Button Customisation #52

Open
ChristopherDoherty opened this issue Dec 20, 2013 · 2 comments
Open

Filter Button Customisation #52

ChristopherDoherty opened this issue Dec 20, 2013 · 2 comments
Labels

Comments

@ChristopherDoherty
Copy link

Hello,
I have been using this fantastic library for a little over two month, and by this point I have fully implemented what I will need for my app. However, I was wondering if anyone knew how to add some more customisation to the UIButton's in the Scroll View, so that I can show names of the custom filters, and also how to add a border for the selected filter. I have attempted to do this for a few hours to no avail. Could anyone help with this?

Regards,
Christopher

@chadkouse
Copy link

Here's how I do a border around the filter button. First turn off all the borders, then set one on the selected one.

-(void) filterClicked:(UIButton *) sender {
    for(UIView *view in self.filterScrollView.subviews){
        if([view isKindOfClass:[UIButton class]]){
            [(UIButton *)view setSelected:NO];
            ((UIButton *)view).layer.borderColor = [[UIColor clearColor] CGColor];
        }
    }

    [sender setSelected:YES];
    sender.layer.borderColor = [[UIColor whiteColor] CGColor];
    [self removeAllTargets];

    selectedFilter = sender.tag;
    [self setFilter:sender.tag];
    [self prepareFilter];
}

to add a label with the name you'd need to edit the loadFilters method and instead of just using the UIButton created there, create your own UIView, add the UIButton and a label, set your label text, then add it

[self.filterScrollView addSubview:yourNewUIView];

@ChristopherDoherty
Copy link
Author

Thanks so much, application nearly finished now!

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

No branches or pull requests

2 participants