2011-10-11 1 views
3

Spotify가 앱이 오프라인 모드로 전환 될 때 UI를 만드는 방법을 파악하는 데 어려움을 겪었습니다. 그들은 StatusBar 크기가 조정 된 것처럼 보이게하지만 실제로는 아래에서보기 만하고 앱 전체에서 모든 컨트롤러의 크기를 조정합니다. 서브 클래 싱 UINavigationController, 하위 클래스 UIWindow, 하위 창의 창 크기를 조정할 시도했지만 모든 경우에 대해 아무것도 작동하는 것 같습니다.Spotify iOS 앱에서 크기를 조정할 수있는 StatusBar을 모방하는 방법

Spotify 앱의 흥미로운 점은 iOS의 자체 UIViewController 하위 클래스가 모달로 표시 될 때 솔루션이 여전히 작동하는 것입니다 (Apple의 MFMailComposeViewController을 보여주는 아래 이미지에서 볼 수 있습니다. 사용자 설정 컨트롤러가 아님을 알 수 있습니다. UIBarButtonItems의).

누군가가이 방법에 대한 통찰력을 가지고 있다면, 그것은 굉장 할 것입니다.

Spotify iOS app

답변

0

그것은 할 수있는 매우 위험한 일입니다. 나는 과거에 해왔고 나에게는 악몽이 있었다. 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]; 
} 

는 그리고이는 모습입니다 :

enter image description here

+0

모달의 ViewController를 제시 할 때 "시세는"아직 모든 것을 꼭대기에 앉아 만약 내가 궁금 하군요? NavigationController의 뷰 크기를 조정하면서 이미 수행중인 작업을 시도했습니다. – Sahil

+0

티커는 UINavigationController 수준에서 추가되므로 UIViewController를 전환하더라도 유지됩니다. 모달 uiViewController를 같은 방식으로 조정할 수 있으므로 원하는 효과를 얻을 수 있습니다. – bioffe

+0

"악몽"에 대해 더 자세히 설명해 주시겠습니까? – pablasso