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

How to change the background color of a component and title of another component depending on which row is selected? #34

Open
M-I-N opened this issue Sep 14, 2017 · 1 comment

Comments

@M-I-N
Copy link

M-I-N commented Sep 14, 2017

I have a menu with two component - one for picking the color & another one for picking the music name. I need to change the background color of the component with the value that is selected from the color options (row). And again need to change the title of the component with the value the is selected from the string options (row).
I have these settings in the dropdown menu:
untitled11
untitled12

Now I need to change the color and music components' background color and title accordingly with the selected item from the row. Like this below image:
untitled13

@maxkonovalov
Copy link
Owner

Hello @M-I-N,

Changing the component title should be simple, provide the necessary title in
- (nullable NSString *)dropdownMenu:(MKDropdownMenu *)dropdownMenu titleForComponent:(NSInteger)component
then in - (void)dropdownMenu:(MKDropdownMenu *)dropdownMenu didSelectRow:(NSInteger)row inComponent:(NSInteger)component, store the selected title value somewhere and call [dropdownMenu reloadComponent:component].

For the background color, it's a bit more complicated, as providing different colors for every component is not supported out of the box. You can work around this by making the menu header color transparent and add your own colored backdrop view behind the menu.

Hope this helps!

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

2 participants