The same dynamic status bar as is in the new Apple Music app
dynamic, ios, objective-c, statusbar, user-interface
Solution
I am 99.99% sure this cannot be done using public API (easily), because I tried myself almost everything there is (i personally also don't think it is some magical method of their status bar, but instead, their application is able to retrieve status bar view and then just apply mask to it).
What I am sure of is that you can do your own StatusBar and there is MTStatusBarOverlay library for that, unfortunately very old one so I can't really tell if that works but it seems that there are still people who use it.
But using the way library does it, I think there might be solution that sure, requires a lot of work, but is doable, though not "live". In a nutshell you would do this:
- Take screenshot of top 20 pixels (status bar)
- From that screenshot, remove everything that is not black (you can improve it so it searches for black edges, this way you can preserve green battery and transparency) This will make your overlay mask and also fake status bar
- Overlay statusbar with : background view masking actual status bar, and the alpha-image you just created
- Apply mask to that image, everything that is masked will change color to shades of white
- Change height of the mask depending on user scroll
Now you should be able to scroll properly and change the color properly. The only problem that it leaves is that status bar is not alive, but is it really? once you scroll out, you immediately remove your overlay, letting it to refresh. You will do the same when you scroll to the very top, but in that case, you change color of the status bar to white (no animation), so it fits your state. It will be not-live only for a brief period of time.
Hope it helps!
Problem
Is it possible to have dynamically coloring `statusBar` which is in the new Apple Music app ? Edit: The new Apple Music app in iOS 8.4 has this feature. - Open the app. - Select and play a song (status bar is white) - Swipe player controller down to see "My music" controller (it has black status bar, maybe you will have to go back in navigation hierarchy). - Now just swipe up/down to see dynamic status bar changes. Edit 2: Apple documentation does not seem to let us use it right now (`iOS 8.4`). Will be available probably in the future with `iOS 9`. Edit 3: Does not seems to be available in `iOS 9` yet.