1

iOS編程的一個特定方面似乎是診斷這些奇怪的,看起來微不足道但令人沮喪的問題。升級到ECSlidingViewController後狀態欄的奇怪外觀2

所以今天,我很高興在我最近的iOS項目上開玩笑,我決定將我的項目升級到最新版本的ECSlidingViewController,它有什麼害處呢?只需更新一些已棄用的方法即可。

所以我做了所有這一切。一切正常,美麗。但是,我注意到狀態欄的行爲很奇怪!當我顯示我的underLeftViewController之一時,它並沒有出現,而且當我將特定的underLeftViewController推到其後續的VC之一時,它出現在一個奇怪的陰影中。什麼??這怎麼可能發生?無論如何,一張圖片勝過千言萬語:

所以這裏是很好的作用和正常: enter image description here

現在消失了!!!: enter image description here

現在有一個奇怪的遮陽!!!: enter image description here

這裏是應用程序與slidin圖片g視圖控制器滑出: enter image description here

我一定對某個地方的狀態欄做了一些瘋狂的事,然後我想。

所以我查看了我的執行文件,其中statusbar表現瘋狂。它實際上是UINavigationController的一個子類,除[super viewDidLoad]行外,其viewDidLoad爲空。所以這裏沒有什麼可疑的。

run test頁面實際上是navVC的rootViewController,所以我研究了它。我把我所有的視圖設置代碼,在其viewDidLoad,這是什麼樣子:

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // remove advanced button 
    self.navigationItem.rightBarButtonItem = nil; 

    self.navigationController.view.layer.shadowOffset = CGSizeMake(1, 0); 

    // setupGaugeView 
    [self setupGauge]; 

    // add run test button 
    [self setupRunTestButton]; 

    // setup notification container 
    CGRect notificationContainerFrame; 
    if ([WRGlobalHelper currentDeviceVersion] >= 7) { 
     CGFloat statusBarHeight = [WRGlobalHelper statusBarHeight]; 
     notificationContainerFrame = CGRectMake(0, [[self.navigationController navigationBar] bounds].size.height+statusBarHeight, self.view.bounds.size.width, 1); 
     for (UIView *subview in self.view.subviews) { 
      CGRect newFrame = subview.frame; 
      newFrame.origin.y += [WRGlobalHelper statusBarHeight]; 
      subview.frame = newFrame; 
     } 
    } else { 
     notificationContainerFrame = CGRectMake(0, [[self.navigationController navigationBar] bounds].size.height, self.view.bounds.size.width, 1); 
    } 
    self.notificationContainerView = [[UIView alloc] initWithFrame:notificationContainerFrame]; 
    self.notificationContainerView.clipsToBounds = NO; 
    self.notificationContainerView.layer.backgroundColor = [UIColor clearColor].CGColor; 
    [self.view addSubview:self.notificationContainerView]; 

    // some other unrelated stuff omitted.... 
} 

而且`viewDidLoad中對在狀態欄作用正常或古怪,但卻與燈罩都是相當普通的風險投資他們看起來像

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view. 

    [self.view addGestureRecognizer:self.slidingViewController.panGesture]; 
} 

頭腦風暴,我放棄在這一點上。我已經在這個單一問題上花了近2個小時,而我的腦子因想到消失狀態欄而感到痛苦。全能的,無所不知的SO,請幫助我!非常感謝你!

回答

0

狀態欄沒有消散,文本僅根據其指定的樣式更改其顏色。
answer將幫助

+0

什麼奇怪的陰影?這似乎像酒吧本身正在改變顏色?我會嘗試解決方案,並讓你知道。 – Enzo

+0

我想這只是狀態欄對底層視圖控制器背景顏色的影響。 – Andrea

相關問題