Snapchat 更新状态栏 iOS7 更新 [英] Snapchat update status bar iOS7 update

查看:28
本文介绍了Snapchat 更新状态栏 iOS7 更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最新的 Snapchat 更新中,当您向右滑动查看消息"时,状态栏会以某种渐变方式从黑色变为白色.

On the latest snapchat update, when you "swipe right for messages" the status bar turns from black to white in a sort of gradient fashion.

http://imgur.com/osJI20u

他们如何在不使用私有 API 的情况下做到这一点,或者他们是否使用私有 API?

How are they doing this without using private API's, or are they using private API's?

我的调查:

乍一看,我以为他们只是在做其他人所做的事情(就像 rdio 目前所做的那样),通过屏幕捕获整个屏幕,然后修改/动画该屏幕截图.

At first glance, I thought they are just doing what everyone else does, (like rdio currently does) by screen capturing the whole screen, and then modifying/animating that screenshot.

但是...您无法通过该屏幕截图方法访问 UIImage 或为其设置动画,因此尽管您可以移动/裁剪该屏幕截图,但您无法更改其外观.

But... you cant access or animate the UIImage from that screen captures method, so although you could move/crop that screenshot, you cannot change its look.

所以...我测试了它,当状态栏处于那种状态(半黑/半白)时,它仍然是实时的,因为它不是屏幕截图,并且它响应充电变化/信号变化等,据我所知,如果不使用私有 API,这是不可能的.

So... I tested it, and when the status bar is in that state (half black/half white), it is still LIVE as in its not a screenshot, and it responds to charging changes/signal changes etc, as far as I can tell this is impossible without using a private API.

推荐答案

这让我很好奇,所以我玩了一下这个应用程序,并在越狱设备上使用 Spark Inspector 检查了应用程序的视图层次结构,我发现了一些事情.

This got me curious so I played with the app a bit and inspected the view hierarchy of the app using Spark Inspector on a jailbroken device and I found a few things.

您对他们不使用屏幕截图的看法不正确.您导航离开的一侧的状态栏是快照并且不会改变.一分钟过去后,您可以很容易地看到这一点,您要转换到的视图的新状态栏将发生变化,因为它是真实的,但旧状态栏不会,因为它是快照.这使得这种错觉很容易解决.

You are incorrect about them not using a screenshot. The status bar on the side you are navigating AWAY from is a snapshot and does not change. You can easily see this when a minute goes by, the new status bar for the view you are transitioning into will have changed because it is real but the old one will not because it is a snapshot. That makes the illusion easy to work out.

以下是高层正在发生的事情:

Here is what is happening at a high level:

  1. 当您开始转换时,应用程序会拍摄状态栏的快照(很可能它实际上是拍摄整个 UIScreen 的快照,然后简单地从中裁剪出状态栏) 在其当前状态,并将包含该快照的窗口附加到转换中视图的顶部,锚定到最终转换位置并被来自"视图控制器的视图屏蔽.此窗口似乎在 UIWindowLevelStatusBar 上方有一个 windowLevel,因此它能够覆盖真正的状态栏.

  1. When you begin the transition, the app takes a snapshot of the status bar(most likely it is actually taking a snapshot of the entire UIScreen and simply cropping the status bar out of it) in its current state and attaches a window containing that snapshot to the top of the view in the transition, anchored to the final transition position and masked by the "from" view controller's view. This window appears to have a windowLevel above UIWindowLevelStatusBar so it is able to cover the real status bar.

然后,to"视图控制器接管实际状态栏并将其更改为light content"状态.这呈现了一个巧妙的错觉,即单个状态栏随过渡边框改变颜色,但真正的状态栏实际上始终位于快照窗口下方,并且如果不是因为快照窗口位于,则在过渡开始时确实会立即可见在它之上.

Then, the "to" view controller takes over the actual status bar and changes it to the "light content" state. This presents the clever illusion that a single status bar changes color with the transition border, but the real status bar is actually always sitting below the snapshot window and would indeed be visible immediately when the transitions begins if it weren't for the snapshot window sitting on top of it.

这篇关于Snapchat 更新状态栏 iOS7 更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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