与新的Apple Music应用程序相同的动态状态栏 [英] Same dynamic status bar as is in the new Apple Music app

查看:381
本文介绍了与新的Apple Music应用程序相同的动态状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在新的 Apple音乐应用中动态着色 statusBar

Is it possible to have dynamically coloring statusBar which is in the new Apple Music app ?

iOS 8.4中的新Apple Music应用程序具有此功能。

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.

编辑2:

Apple文档似乎不让我们现在使用它( iOS 8.4 )。将来可能会使用 iOS 9

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.

编辑3:
似乎在 iOS 9 中似乎不可用。

推荐答案

p>我是99.99%肯定这不能使用公共API(容易),因为我几乎尝试了所有的东西(我个人也不认为这是一些神奇的方式,他们的状态栏,而是他们的应用程序能够检索状态栏视图,然后只需应用蒙版)。

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).

我所确定的是,您可以做自己的StatusBar,而且 MTStatusBarOverlay 库,不幸的是非常老的,所以我不能真正地告诉这是否有效,但似乎还有人使用它。

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:


  • 截图前20像素(状态栏)

  • 从该截图中,删除所有不是黑色的(你可以改进它,所以它搜索黑色的边缘,这样你可以保留绿色电池和透明度)这将使您的覆盖面罩和假状态栏

  • 覆盖状态栏:背景视图屏蔽实际状态栏,以及刚刚创建的Alpha图像

  • 将蒙版应用于该图像,所有被蒙蔽的东西都会将颜色变为白色阴影

  • 根据用户滚动更改面具的高度

  • 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

现在您应该能够正确滚动d正确改变颜色。它唯一的问题是状态栏不活着,但它是真的吗?一旦你滚动出来,你立即删除你的叠加层,让它刷新。当您滚动到最上方时,您将会做同样的事情,但是在这种情况下,您将状态栏的颜色更改为白色(无动画),因此它适合您的状态。它将不会在短时间内生活。

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.

希望它有帮助

这篇关于与新的Apple Music应用程序相同的动态状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆