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

Unable to add custom views to IndicatorView #46

Closed
amorde opened this issue Feb 10, 2017 · 5 comments
Closed

Unable to add custom views to IndicatorView #46

amorde opened this issue Feb 10, 2017 · 5 comments

Comments

@amorde
Copy link
Contributor

amorde commented Feb 10, 2017

I'm not sure if this is a feature you are interested in supporting, but my team maintains an in-house fork to be able to add subviews to the indicatorView to support UI that isn't provided.

In our case, we have a view which behaves as an "underline" for the currently selected index and moves along with the indicator view. If we decide to do something different, we can always just change our custom view to look however we want.

The change required to support this is changing the access modifier of the indicatorView property and the IndicatorView class to public. Of course, you could always code in accessors like addSubviewToIndicator or something similar.

Let me know what you think - if this is something you are interested in supporting, I'd be happy to submit a pull request

@danielchristopher1
Copy link

+1 for this

@amorde
Copy link
Contributor Author

amorde commented Mar 15, 2017

@gmarm Any chance you could take a look and give us your thoughts? If you're open to the idea I'd be more than happy to submit a pull request

@gmarm
Copy link
Owner

gmarm commented Mar 20, 2017

Hey @amorde, apologies for my late response, had no time lately!

Yes, let's discuss this. Apart from a title underline view, do you think any other customization makes sense for the indicator view? I can't think of too many things really.

Making it public would be something I'd do as a last resort, but for example something like a set of properties to show and customize an underline view could be nice.

@amorde
Copy link
Contributor Author

amorde commented Mar 20, 2017

I think it makes sense in that being able to add customization to the indicator view (which handles the "swipe" animation) is a pretty nice feature. Sure, you could add support for an underline, but it would be great if developers could extend it to provide any type of view there.

Some examples of customizations might include:

  • Adding an image or other custom view to denote "selected" segments
  • Adding a gradient to match a given app's brand
  • Adding a view which only shows up on certain segments
  • Adding a view which performs a custom animation on valueChanged

What do you think about the second option in my original comment? That is, adding a method like addSubviewToIndicator which would allow you to provide whatever view you want without exposing the underlying type

@gmarm
Copy link
Owner

gmarm commented Mar 22, 2017

Yep, addSubviewToIndicator is not a bad idea!

Feel free to submit a PR with the addition and also please include a basic test case.

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

No branches or pull requests

3 participants