What's a good way to create an overlay look that will stay on top?

I like to create a small overlay view that will float on top of everything else. I need an opinion to get the finishing touches, and I need it to stay in place even during transitions between main views. What I have tried so far:

  • The offline view is inserted into the key UIWindow

    . The obvious downside is that the view is not tied to any view controller, which means handling (at least?) The rotation events manually.

  • UIViewController

    , there is a "root" view controller that will hold the floating view and all navigation will be done underneath it. This is a "first class citizen" solution, but the view of the modal view controller overrides the floating view.

  • The second is UIWindow

    with a root view controller containing a floating view. This is contrary to Apple guidelines and I had some problem filtering events that should happen in which window.

Does anyone have a working solution that doesn't require too much brittle hack?

+3


source to share


1 answer


In the end, I followed Jonathan's suggestion and implemented the overlay as a separate view inserted into the key window. The view has an associated controller object (subclass NSObject

, not UIViewController

), and that controller executes the rotation logic. Thus, the view that implements the actual overlay object does not need to care about rotation events at all.



0


source







All Articles