簡體   English   中英

導航欄標題背景在iOS11中是白色的

[英]Navigation Bar Title background is white in iOS11

出於某種原因,在iOS 11中,導航欄中的標題標簽具有白色背景:

導航欄以標題的白色背景

這只是一個普通的導航控制器,標題設置為默認方式:

self.title = @"My Title";

這個問題只發生在iOS 11中,屏幕截圖是從模擬器中獲取的,否則對於以前的iOS版本,這個工作正常。

有關我如何擁有正常的清晰背景標簽或刪除因任何原因即將出現的白色背景的任何建議?

檢查是否已正確設置標題文本屬性。 您可以從Storyboard或Programatically設置標題文本屬性。 選擇Storyboard -> NavigationBar -> Go to attribute inspector -> Title Text Attributes

在此輸入圖像描述

或者在ViewController中嘗試手動設置它

斯威夫特4:

         self.navigationController?.navigationBar.titleTextAttributes = [
            NSAttributedStringKey.foregroundColor: UIColor.white,
            NSAttributedStringKey.font: UIFont.systemFont(ofSize: 17, weight: .bold)
        ]

斯威夫特3:

        self.navigationController?.navigationBar.titleTextAttributes = [
            NSForegroundColorAttributeName: UIColor.white,
            NSFontAttributeName: UIFont.systemFont(ofSize: 17, weight: .bold)
        ]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM