I want to show the Now Playing button in the UINavigationController panel.
I have a class (NowPlayingManager) that I use to track whether an audio file is currently playing. I am using a notification sent in another class (AudioViewController) to indicate playback status. AudioViewController creates an instance of NowPlayingManager with alloc / init and frees it. In the NowPlayingManager of the received notification, I set NowPlayingManager isNowPlaying Boolean to YES.
When the sound stops playing, I send another notification that sets the isNowPlaying bool to NO.
However, each time the class is initialized, bool is set to NO, which makes sense because it is a new instance of NowPlayingManager and the Now Playing button is never displayed.
How can I get the isNowPlaying bool to persist through all instances of my NowPlayingManager? Or rather, Should I delegate the init application for NowPlayingManager, not the AudioViewController, to create only one instance?
source
share