maxkonovalov / MKDropdownMenu

🔻 Dropdown Menu for iOS with many customizable parameters to suit any needs
MIT License
524 stars 83 forks source link

About disclosureIndicatorImage #17

Open MourinhoLove opened 7 years ago

MourinhoLove commented 7 years ago

How Can I change disclosureIndicatorImage position When I change headheaderComponents title?

maxkonovalov commented 7 years ago

Hello @MourinhoLove! This is not supported currently, and I don't plan to add this feature in nearest future, sorry.

Daltron commented 7 years ago

I am also in favor of this as I want the arrow to be directly right after my text. My text displayed is dynamic so a predefined width won't always work.

Daltron commented 7 years ago

@MourinhoLove Here is what worked for me. When creating a new drop down menu with dynamic text, calculate the size of the string as follows:

let size = (title as NSString).size(attributes: customTextAttributes)
let dropdownMenu = MKDropdownMenu(frame: CGRect(x: 0, y: 0, width: size.width + 35, height: 44))

Notice I add +35 to the width. This is because I want the disclosureIndicatorImage to fit into the bounds as well. This could be slightly smaller/larger depending on the size of your indicator image.

Hope this helps! 😄

MourinhoLove commented 7 years ago

@Daltron Thank you for your answer. Its help me.

keithburgoyne commented 7 years ago

I would also find this very useful. I'm not sure I want to recreate the menu every time a menu item is selected. I have my menu updating the component title whenever a row is selected.

BeQuietLee commented 6 years ago

@keithburgoyne +1

lorenzoPrimi commented 6 years ago

@Daltron do you have the obj-c code for that? I need to have the image next to the text. Thanks