如何在 Spotify iOS 应用程序中模仿可调整大小的 StatusBar
我一直在努力弄清楚 Spotify 如何在应用程序进入离线模式时创建 UI。他们看起来好像 StatusBar
已经调整了大小,但实际上他们只是在下面放置了一个视图,并调整了整个应用程序中所有控制器的大小。我尝试过对 UINavigationController
进行子类化、对 UIWindow
进行子类化、调整窗口大小,但似乎没有任何方法适用于每种情况。
Spotify 应用程序的有趣之处在于,当 iOS 自己的 UIViewController
子类以模态方式呈现时,他们的解决方案似乎仍然有效(如下图所示,显示了苹果的 MFMailComposeViewController
- 由于 UIBarButtonItems,您可以看出它不是自定义控制器。
如果有人知道这是如何可能的,那就太棒了。
I've been struggling to figure out how Spotify creates the UI for when the app goes into offline mode. They make it seem like the StatusBar
has resized, but in reality they're just putting a view below, and resizing all controllers throughout the app. I've tried subclassing UINavigationController
, subclassing UIWindow
, resizing the window, but nothing seems to work for every case.
The interesting thing about the Spotify app, is that their solution seems to still work when iOS' own UIViewController
subclasses are presented modally (as seen in the image below, showing apple's MFMailComposeViewController
- you can tell it's not a custom controller because of the UIBarButtonItems).
If anyone has any insight into how this is possible, that would be awesome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一件非常危险的事情。我过去做过,也做过噩梦。下面的代码适用于 iOS4 并支持方向更改。
它看起来是这样的:
it's a very dangerous thing to do. I've done in the past and I had nightmares. Below the code that works in iOS4 and supports orientation changes.
And this is how it looks: