MKDropdownMenu icon indicating copy to clipboard operation
MKDropdownMenu copied to clipboard

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

Open M-I-N opened this issue 7 years ago • 1 comments

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

M-I-N avatar Sep 14 '17 07:09 M-I-N

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!

maxkonovalov avatar Sep 15 '17 18:09 maxkonovalov