GitHawkApp / ContextMenu

An iOS context menu UI inspired by Things 3.
http://githawk.com/
MIT License
982 stars 51 forks source link

tint-dimming behind ContentMenu #20

Closed palmin closed 6 years ago

palmin commented 6 years ago

This is a very nice implementation and I plan to use it in Working Copy for switching between branches and file modes.

Everything behind ContextMenu is dimmed slightly with the overlay, but I'm trying to also dim the tint using the UIViewTintAdjustmentModeDimmed mechanism. This makes it much clearer that the ContextMenu has focus.

Do you know of some way to inform UIKit that this should happen?

A regular modalPresentationStyle = .popover gives this effect, but I cannot figure out how to achieve this with modalPresentationStyle = .custom.

Being really picky about my development tools I'm still waiting for Swift tooling to mature and ported most of ContextMenu to objective-c. Is this something you would like to get back into the project or would you rather not?

dim

palmin commented 6 years ago

This was the easiest way for me to ask this question and it is not a issue with ContextMenu as such. Feel free to close the issue without a second thought.

palmin commented 6 years ago

I found a solution that seems to work.

Setting window.tintAdjustmentMode = UIViewTintAdjustmentModeDimmed when presenting ContextMenu and resetting to window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal when dismissing dims tint colors behind ContextMenu while shown but leaves the one inside ContextMenu normal.

I presume UIKit adjusts tintAdjustmentMode on presented view controllers.

rnystrom commented 6 years ago

@palmin this is awesome! I might add this as a config param then since it looks pretty easy and has a really cool effect!

Sent with GitHawk