I have a requirement to display a thin status-bar-like view below the navigation bar that slides into view and remains visible for several seconds before sliding back out of sight when certain actions occur.
I could do this easily enough for any given view controller by animating its frame as appropriate when it needs to appear/disappear.
However I have a few different view controllers and I don’t want to duplicate the same code for managing the appearance of the bar in each controller. Besides duplication of code I suspect there’ll be flicker when navigating between controllers if the bar is currently meant to be visible at the time of changing controllers.
What are options for approaching this problem?
Create a method in your appDelegate to add your custom view to the main window.
This way anytime you trigger show custom view method it will be at the top of the view hierarchy.
One thing to note is that if your app changes the orientation you have to change it manualy for your custom view.