2013-10-17 38 views

回答

2

狀態欄已經從iOS7改變了很多後續版本,你可以讀到這裏:https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Bars.html#//apple_ref/doc/uid/TP40006556-CH12-SW1

更好的問題應該是─你怎麼喜歡你的狀態欄的行爲在iOS 6.1? 關於左欄按鈕項目,爲了使iOS6.1按鈕看起來像iOS7.0按鈕,您必須創建一個自定義的按鈕 - 這可以完成。例如創建一個類似於iOS7的箭頭圖像(我在下面的代碼中稱之爲「back_arrow.png」),並且在需要看起來像iOS7.0按鈕時編寫以下內容(在編寫以下代碼之前檢查iOS版本,寫入它僅適用於iOS版本< 7.0)

 UIImage * backButtonImage = [UIImage imageNamed: @"back_arrow.png"]; 
     [[UIBarButtonItem appearance] setBackButtonBackgroundImage: backButtonImage forState: UIControlStateNormal barMetrics: UIBarMetricsDefaultPrompt]; 

     [[UIBarButtonItem appearance] setBackButtonBackgroundImage: backButtonImage forState: UIControlStateNormal barMetrics: UIBarMetricsDefaultPrompt]; 

     NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: 
            [UIColor clearColor], 
            UITextAttributeTextColor, 
            [UIFont fontWithName:@"HelveticaNeue-Bold" size:14], 
            UITextAttributeFont, 
            [UIColor colorWithRed:70.0/255.0 green:120.0/255.0 blue:251.0/255.0 alpha:1.0], 
            UITextAttributeTextShadowColor, nil]; 

     NSDictionary *highlightedAttributes = [NSDictionary dictionaryWithObjectsAndKeys: 
            [UIColor clearColor], 
            UITextAttributeTextColor, 
            [UIFont fontWithName:@"HelveticaNeue-Bold" size:14], 
            UITextAttributeFont, 
            [UIColor colorWithRed:70.0/255.0 green:120.0/255.0 blue:251.0/255.0 alpha:0.7], 
            UITextAttributeTextShadowColor, nil]; 



     [[UIBarButtonItem appearance] setTitleTextAttributes: attributes 
                forState: UIControlStateNormal]; 
     [[UIBarButtonItem appearance] setTitleTextAttributes: highlightedAttributes 
                forState: UIControlStateHighlighted]; 
     [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0,0) forBarMetrics:UIBarMetricsDefaultPrompt]; 
+0

非常感謝! – Gavjr