How do I make a view that does not appear to be reloaded (stays onscreen) every time a view segues? Like the audio controls in Apple's iOS podcast app. See pictures to see audio controls I am referencing.
How do I do it in storyboard?
To create a segue between view controllers in the same storyboard file, Control-click an appropriate element in the first view controller and drag to the target view controller. The starting point of a segue must be a view or object with a defined action, such as a control, bar button item, or gesture recognizer.
instantiateViewController(withIdentifier:)Creates the view controller with the specified identifier and initializes it with the data from the storyboard.
What you are referring to is usually called "mini player", you'll find it in many other apps too.
The technique you should use is called "UIViewController Containment", in storyboards it is accessible as "Container View" and "Embed Segues".
A typical storyboard might look like:
This will create the view controller hierarchy.
To implement the player itself create a player class that you instantiate in the app delegate and pass it to a property on the root vc. from there pass it to the mini player view controller and to the upper view controller, that will contain the list of songs/podcast/... to select from. At selection pass hat song to the player class.
I posted an example app at GitHub: https://github.com/vikingosegundo/HearThisMiniplayer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With