2013-11-20 50 views
5

我遇到問題,無法解決問題。我會盡力來形容這個問題,所以:當iOS7中的標題太長時,隱藏UINavigationBar後退按鈕標題

UINavigationBar的標題是沒有那麼長 - 的情況是這樣的:

enter image description here

但如果欄的標題中含有較多人物 - 它隱藏後退按鈕的標題爲u可以在下面的截圖看到:

enter image description here

它是一個標準的UINavigationBar行爲iOS7?可能有一些方法可以解決這個問題嗎?無論如何,在iOS6情況要好得多 - 我找不到像這樣的問題。

enter image description here

+1

imho - 沒關係,並試圖相信蘋果關於用戶體驗的決定。如果後退按鈕沒有任何屬性 - 嘗試使用自定義後退按鈕看起來與默認相同。 –

+0

'[[UIBarButtonItem alloc] initWithCustomView:yourView]' –

回答

7

簡單修復:

創建一個視圖與標籤並設置視圖作爲標題視圖到導航控制器

// creating title view 
UIView *titleView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 40)]; 
    // Adding label with custom frame 
    UILabel *labelForTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)]; 

    [labelForTitle setCenter:titleView.center]; 
    [labelForTitle setText:@"sfdfagd ggjhdgfjhadsgfjasgdhfgasdjfgajsdgfjashgdjhfasjdfsadjgfhsadghf"]; 

    [titleView addSubview:labelForTitle]; 

    // setting title view for the navigation controller. 
    [self.navigationItem setTitleView:titleView]; 

輸出將是這樣的:

enter image description here

相關問題