我一直在努力弄清楚Spotify如何在应用进入离线模式时创建用户界面。它们看起来好像StatusBar
已调整大小,但实际上它们只是在下面放置一个视图,并调整整个应用程序中的所有控制器的大小。我已经尝试了子类化UINavigationController
,子类化UIWindow
,调整窗口大小,但似乎没有任何效果。
Spotify应用程序的有趣之处在于,当iOS自己的UIViewController
子类以模态方式呈现时,他们的解决方案似乎仍然有效(如下图所示,显示了苹果的MFMailComposeViewController
- 你可以告诉它不是自定义控制器,因为UIBarButtonItems。)
如果有人对如何做到这一点有任何了解,那就太棒了。
答案 0 :(得分:0)
- (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];
}
这就是它的样子: