- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我一直在努力弄清楚 Spotify 如何在应用进入离线模式时创建 UI。他们让 StatusBar
看起来像是调整了大小,但实际上他们只是在下方放置了一个 View ,并调整了整个应用程序中所有 Controller 的大小。我试过子类化 UINavigationController
、子类化 UIWindow
、调整窗口大小,但似乎对所有情况都不起作用。
关于 Spotify 应用程序的有趣之处在于,当 iOS 自己的 UIViewController
子类以模态方式呈现时,他们的解决方案似乎仍然有效(如下图所示,显示了苹果的 MFMailComposeViewController
- 由于 UIBarButtonItems,您可以看出它不是自定义 Controller )。
如果有人知道这是如何实现的,那就太棒了。
最佳答案
这是一件非常危险的事情。我过去做过,我做过噩梦。下面是适用于 iOS4 并支持方向更改的代码。
- (void) _adjustViewControllerforTicker {
TickerView* vv = [ApplicationContext getTickerView];
if ([PreferenceDataModel isFxTickerOn]&& self.navigationController.view.frame.origin.y==0) {
CGRect tableRect = self.tableView.frame;
self.tableView.frame = CGRectMake(tableRect.origin.x,tableRect.origin.y, tableRect.size.width, tableRect.size.height -20);
UINavigationController *nav = self.navigationController;
CGRect gframe = CGRectOffset(self.navigationController.view.frame, 0, 20);
self.navigationController.view.frame = gframe;
if (!vv) {
vv = [[TickerView alloc] initWithFrame:CGRectMake(0, 0, 480, 20)];
[nav.view addSubview:vv];
[vv release];
self.tableView.contentInset=UIEdgeInsetsMake(0,0,20.0,0.0);
[ApplicationContext setTickerView:vv];
}
if (![PreferenceDataModel isTickerOn]) {
self.tableView.contentInset= UIEdgeInsetsZero;
if (vv){
[vv removeFromSuperview];
vv=nil;
[ApplicationContext setTickerView:nil];
}
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
[self _adjustViewControllerforTicker];
}
- (void) viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self _adjustViewControllerforTicker];
TickerView* vv = [ApplicationContext getTickerView];
if ([vv count]) {
[vv startAnimation];
}
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self _adjustViewControllerforTicker];
}
这是它的样子:
关于iphone - 如何在 Spotify iOS 应用程序中模仿可调整大小的 StatusBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7721584/
尽管安装了状态栏插件,但我无法将 ionic/cordova iOS 应用程序中状态栏上的字体颜色更改为白色: cordova plugins ... org.apache.cordova.statu
我已经针对 KitKat 创建了一个单独的 xml 样式文件,并且我已经设法更改了状态栏的颜色。图片上唯一的副作用是,所有内容现在都向上移动到状态栏下方。我的问题是如何在不覆盖状态栏的情况下更改状态栏
在我的活动召唤的那一刻。在其onCreate方法内部,以隐藏状态栏并以全屏模式显示。。作为向Android 30迁移的一部分,正如文档所建议的那样,我用WindowInsetsController#H
我刚刚使用下一个命令创建了一个新应用: ionic start myapp 一切正常,但是当我尝试部署到 Android 时(我的 Android studio 环境已正确安装和配置),我收到下一个错
我想查看在 PyCharm 或任何其他 JetBrains IDE 中使用 IdeaVIM 时当前处于哪种 Vim 模式。 碰巧我用鼠标选择了单个字符(例如意外双击单个字母),然后光标无法正确区分正常
我正在构建一个应用程序,它需要有一个状态栏项目和一个自定义弹出窗口,单击状态栏项目时会弹出该窗口。 我知道如何为其设置状态栏项目和 ns 菜单,但我需要自定义窗口而不是 ns 菜单。 我正在寻找的一个
我们有一个 WPF 可执行文件,它创建一个程序集,然后动态加载多个程序集。每个程序集代表一个显示在选项卡之一中的屏幕 (.xaml)。问题是它位于窗口的正下方而不是底部。我如何强制 始终位于底部 wi
我有一个带有菜单栏和状态栏的 MDIForm。当我创建一个子窗体并将其定位为“Align = alBottom”时,该窗体会离开屏幕区域,并且主窗体滚动条被激活。如何将子窗体定位在状态栏上方? 最佳答
首次创建 StatusBar 时,例如: HWND hStatusBar = CreateWindowEx(0, STATUSCLASSNAME, "", WS_CHILD | WS_VISIBLE,
我想实现一个状态栏,我将能够在指定的时间段内显示消息,之后它们将淡出。 这可以用 wpf 中任何现成的控件来完成吗?我在 StatusBar 中找不到这样的功能,据我所知,它是其他项目的容器。 有什么
我的第一个 ViewController 是纵向的,第二个 ViewController 是横向的。第一个 ViewController 有状态栏,第二个没有。 然后我显示第一个 ViewContro
我使用以下代码更改我的 ViewController 中的 StatusBar 颜色: override func viewWillAppear(_ animated: Bool) { sup
我无法创建两个以上的 StatusBar 部分: HWND hStatusBar = CreateWindowEx(0, STATUSCLASSNAME, "", WS_CHILD | WS_VISI
StatusBar 中每个 TextBlock 之间的分隔条似乎具有不相等的宽度。有些条看起来比其他条更细。左数第一和第四个条比第二个和第三个粗。如果有人可以为等宽分隔符提供任何解决方案,我将不胜感激
我的 Activity 使用 CollapsingToolbarLayout 并且我成功删除了 StatusBar 这样做: View decorView = getWindow().getDecor
我正在从 UINavigationController 中的 VC1 推送到 VC2。 VC2有一个透明的navigationBar。 在 VC2 中的 viewDidLoad 中: self.nav
我想创建一个可用于显示和隐藏状态栏的全局函数。这是我所做的: class Helper { class func hide() { let app = UIApplicat
我有一个管理其中所有其他 Controller 的 Root View Controller ,所以我覆盖了 rootViewController 中的 shouldAutorotate 和 supp
我正在为我的状态栏图像使用以下代码: let icon = NSImage(imageLiteralResourceName:"flag") statusBarItem.image = icon 这会
fileprivate lazy var netTipWindow:UIWindow = { let window = UIWindow(frame: CGRect(x: 0, y:
我是一名优秀的程序员,十分优秀!